Created
April 1, 2015 18:10
-
-
Save thomastuts/f3b198d60625d73996c2 to your computer and use it in GitHub Desktop.
Revisions
-
Thomas Tuts created this gist
Apr 1, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ // tasks/bundle.js 'use strict'; var gulp = require('gulp'); var browserify = require('browserify'); var watchify = require('watchify'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var concat = require('gulp-concat'); var gutil = require('gulp-util'); var bundler = watchify(browserify('./app/src/app.js', watchify.args)); bundler.transform('reactify'); bundler.transform('babelify'); bundler.on('update', bundle); // on any dep update, runs the bundler function bundle() { return bundler.bundle() // log errors if they happen .on('error', gutil.log.bind(gutil, 'Browserify Error')) .pipe(source('bundle.js')) // optional, remove if you dont want sourcemaps .pipe(buffer()) // .pipe(gulp.dest('./app/src')); } module.exports = bundle; 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // gulpfile.js 'use strict'; var gulp = require('gulp'); gulp.task('serve', ['bundle', 'watch'], require('./tasks/serve')); gulp.task('watch', require('./tasks/watch')); gulp.task('bundle', require('./tasks/bundle')); gulp.task('default', ['serve']); 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ // tasks/serve.js 'use strict'; var browserSync = require('browser-sync'); module.exports = function () { browserSync({ files: './app/src/bundle.js', server: { baseDir: ['./app', './'] }, notify: false }); }; 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ // tasks/watch.js 'use strict'; var gulp = require('gulp'); module.exports = function () { return gulp.watch([ 'app/src/**/*.js', '!app/src/bundle.js' ], ['bundle']); };