Created
May 29, 2014 18:49
-
-
Save bmihelac/8c3eab3c6de16584cd48 to your computer and use it in GitHub Desktop.
gulp app browserify task
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
'use strict'; | |
var browserify = require('browserify'); | |
var gulp = require('gulp'); | |
var rename = require('gulp-rename'); | |
var uglify = require('gulp-uglify'); | |
var source = require('vinyl-source-stream'); | |
var libs = require('./vendor').libs; | |
gulp.task('app', function() { | |
var production = (process.env.NODE_ENV === 'production'); | |
var stream = browserify('./js/app.js') | |
.transform('reactify'); | |
libs.forEach(function(lib) { | |
stream.external(lib); | |
}); | |
stream.bundle({ | |
insertGlobals : false, | |
debug: !production | |
}) | |
.pipe(require('mold-source-map').transformSourcesRelativeTo('http://localhost:8000')) | |
.pipe(source('app.js')) | |
.pipe(gulp.dest('dist/scripts')); | |
return stream; | |
}); | |
exports.libs = libs; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment