-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
30 lines (26 loc) · 985 Bytes
/
Gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var gulp = require( 'gulp' );
var gutil = require( 'gulp-util' );
var source = require( 'vinyl-source-stream' );
var watchify = require( 'watchify' );
var browserify = require( 'browserify' );
var babelify = require( 'babelify' );
var assign = require( 'object-assign' );
var bundler = watchify( browserify( './src/js/app.jsx',
assign( watchify.args, { debug: true } ) ) ); //add inline sourcemap
// add any other browserify options or transforms here
bundler.transform( babelify.configure(
{
stage: 0
} ) );
gulp.task( 'js', bundle ); // so you can run `gulp js` to build the file
bundler.on( 'update', bundle ); // on any dep update, runs the bundler
bundler.on( 'log', gutil.log ); // output build logs to terminal
function bundle()
{
return bundler.bundle()
// log errors if they happen
.on( 'error', gutil.log.bind( gutil, 'Browserify Error' ) )
.pipe( source( 'bundle.js' ) )
//
.pipe( gulp.dest( './www/assets/js/' ) );
}