Browserify with sourcemaps
-
Install Browserify
$ npm install -g browserify
-
Create your package.json file
$ npm init
-
Install both jQuery and Lo-Dash from npm
$ npm install jquery lodash --save
-
js/modules/app.js
-
no minification
$ browserify src/njs/main.js -o src/js/main.js
-
minification and source maps
A. $ npm install uglifyify
w/o source maps $ browserify -g uglifyify src/js/index.js > js/app.js --debug flag generates inline source maps $ browserify -g uglifyify --debug src/js/index.js > js/app-debug.js
B. Browserify Uglify2 with sourcemaps (Gulp Recipe)
$ npm install gulp --save $ npm install browserify --save $ npm install vinyl-source-stream --save $ npm install vinyl-buffer --save $ npm install gulp-uglify --save $ npm install gulp-sourcemaps --save $ npm install gulp-util --save $ gulp javascript
-
BrowserSync Static Server
$ npm install browser-sync --save-dev with gulp: http://www.browsersync.io/docs/gulp/