Last active
November 22, 2016 11:59
-
-
Save akirattii/540e7d59530c205528550b006e41be91 to your computer and use it in GitHub Desktop.
How to browserify & uglify ES2015 code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Install browserify: | |
| $ npm install -g browserify | |
| # Install uglify-js: | |
| ### First remove already installed one: | |
| $ npm remove uglify-js -g | |
| ### Install the ES2015 compatible version from 'harmony' branch: | |
| $ npm install -g https://github.com/mishoo/UglifyJS2.git#harmony | |
| # Try uglify of ES2015 code: | |
| ### 'input.js' is written in ES2015 | |
| $ uglifyjs --compress --mangle -- input.js | |
| # browserify collaborate with uglifyjs: | |
| $ browserify ./public/javascripts/app.js | uglifyjs > ./public/javascripts/bundle.min.js | |
| # example output: | |
| # bundle.js 2.4M (non-uglified) | |
| # bundle.min.js 748K (uglified) <- Awesome! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment