Last active
May 30, 2017 22:57
-
-
Save byverdu/5a205ece24324279d3ea6333e5cfa801 to your computer and use it in GitHub Desktop.
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
// build/tasks/browserify.js | |
const gulp = require( 'gulp' ); | |
const browserify = require( 'browserify' ); | |
const uglify = require( 'gulp-uglify' ); | |
const source = require( 'vinyl-source-stream' ); | |
const gutil = require( 'gulp-util' ); | |
const buffer = require( 'vinyl-buffer' ); | |
const sourcemaps = require( 'gulp-sourcemaps' ); | |
const notify = require( 'gulp-notify' ); | |
const babelify = require( 'babelify' ); | |
gulp.task( 'browserify', () => { | |
// set up the browserify instance on a task basis | |
const b = browserify({ | |
entries: './app/client/js/router.js', | |
debug: true, | |
transform: [babelify] | |
}); | |
return b.bundle() | |
.pipe( source( 'bundle.js' )) | |
.pipe( buffer()) | |
.pipe( sourcemaps.init({ loadMaps: true })) | |
// Add transformation tasks to the pipeline here. | |
.pipe( uglify({ mangle: true })) | |
.on( 'error', gutil.log ) | |
.pipe( sourcemaps.write( './' )) | |
.pipe( gulp.dest( './app/client/static' )) | |
.pipe( notify({ message: 'Browserify completed' })); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment