Giter VIP home page Giter VIP logo

electrode-electrify's Introduction

electrify NPM version Build Status NPM Downloads

What is Electrify?

Electrify is an webpack visualizer tool for visualizing and analyzing Webpack bundles, it is a UI tool based on D3.js for visualizing the module tree of electrode + webpack project bundles. It's especially handy for catching large and/or duplicate modules which might be either bloating up your bundle or slowing down the build process.

Checkout a live working DEMO.

screencast

Installation

Electrify lives on npm, so if you haven't installed npm already make sure you have node installed on your machine first.

Installing should then be as easy as:

sudo npm install -g electrode-electrify

Drag & Drop Stats JSON

Electrify supports drag and drop of webpack stats json to visualize it. Running it easy:

$ npm run start

drag

Command-Line Interface

Note: you'll need to build your project with the fields: null flag if you are using webpack-stats-plugin, pass a fully generated webpack-stats-object for electrify to render the tree accurately.

electrify [stats-bundle(s)...] {options}

Options:
  -h, --help    Displays these instructions.
  -O, --open    Opens viewer in a new browser window automatically
  -m, --mode    the default file scale mode to display: should be
                either "count" or "size". Default: size

When you install electrify globally, electrify command-line tool is made available as the quickest means of checking out your bundle. As of [email protected], the tool takes any webpack-stats object example as input and spits out a standalone HTML page as output.

You can easily chain the stats file into another command, or use the --open or -O flag to open electrify in your browser automatically:

For example:

electrify build/stats.json --open

API Integration

Note: you'll need to build your project with the fields: null flag if you are using webpack-stats-plugin, pass a fully generated webpack-stats-object for electrify to render the tree accurately.

electrify.bundle(stats, [opts], callback)

A callback-style interface for electrify: takes a single stats file or an array of stats (note: the file names and not the file contents), calling callback(err, html) with either an error or the resulting standalone HTML file as arguments.

This currently mirrors how electrify is currently implemented, but the stream API is a little more convenient to work with.

This method takes the following options:

  • header: HTML to include above the visualisation. Used internally to render the "Fork me on GitHub" ribbon.
  • footer: HTML to include beneath the visualisation. Used internally for the description on the demo page.
  • mode: the default file scale mode to display: one of either "count" or "size", defaulting to "size".

bundle api example: electrify.bundle(stats, [opts], callback)

Palettes

You can switch between multiple color palettes, most of which serve to highlight specific features of your bundle:

Structure Highlights

Structure Highlights

Highlights node_modules directories as green and lib directories as orange. This makes it easier to scan for "kitchen sink" modules or modules with lots of dependencies.

File Types

File Types

Highlights each file type (e.g. .js, .css, etc.) a different color. Helpful for tracking down code generated from a transform that's bloating up your bundle more than expected.

Original/Pastel

Pastel

Nothing particularly special about these palettes – colored for legibility and aesthetics respectively.

Search By Filename

Search by filename to get to the exact location of the file along with size that file is contributing to the Javascript bundle. Props to @jherr for implementing the Search functionality.

License

Apache-2.0 © WalmartLabs
Built with ❤️ by Team Electrode @WalmartLabs.

Other useful bundle/stats viewers

electrode-electrify's People

Contributors

ananavati avatar andypham avatar georgeweiler avatar jchip avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.