From b8b98edbf59a5a6948725f459e351593d215eac6 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Tue, 25 Nov 2014 08:55:07 -0500 Subject: [PATCH] Making browserify setup inline in gulpfile --- gulpfile.js | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 83c5312..0a798ed 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,9 +1,6 @@ var gulp = require('gulp'), notify = require('gulp-notify'), plumber = require('gulp-plumber'), - browserify = require('browserify'), - es6ify = require('es6ify'), - tap = require('gulp-tap'), config = require('./config'); function errorHandler() { @@ -12,18 +9,6 @@ function errorHandler() { }); } -function browserifyPipe() { - return tap(function(file) { - var bundler = browserify(config.browserify); - - bundler.add([file.path, es6ify.runtime]); - bundler.transform(require('./lib/canopy-transform')); - bundler.transform(es6ify); - - file.contents = bundler.bundle(); - }); -} - gulp.task('default', ['server'], function() { gulp.watch(config.globs.other, ['static']); gulp.watch([config.globs.html, config.templateFile], ['markup']); @@ -70,9 +55,21 @@ gulp.task('compass', function() { }); gulp.task('browserify', function() { + var browserify = require('browserify'), + es6ify = require('es6ify'), + tap = require('gulp-tap'); + return gulp.src('./src/js/main.js', { read: false }) .pipe(errorHandler()) - .pipe(browserifyPipe()) + .pipe(tap(function(file) { + var bundler = browserify(config.browserify); + + bundler.add([file.path, es6ify.runtime]); + bundler.transform(require('./lib/canopy-transform')); + bundler.transform(es6ify); + + file.contents = bundler.bundle(); + })) .pipe(gulp.dest('./build/js')); });