Skip to content

Instantly share code, notes, and snippets.

@interjc interjc/gulpfile.js forked from alyssaq/gulpfile.js
Created Oct 16, 2015

Embed
What would you like to do?
browserify, babel, gulp, glob, vinyl-source-stream, uglify
/*
npm install gulp gulp-load-plugins gulp-uglify
npm install browserify babelify glob vinyl-source-stream vinyl-buffer
More examples: https://github.com/gulpjs/gulp/tree/master/docs/recipes
*/
var gulp = require('gulp')
var $ = require('gulp-load-plugins')()
var browserify = require('browserify')
var babelify = require('babelify')
var glob = require('glob')
var source = require('vinyl-source-stream')
var buff = require('vinyl-buffer')
gulp.task('browserify', function () {
var files = glob.sync('./app/scripts/**/*.js');
return browserify({
entries: files,
debug: true
})
.transform(babelify)
.bundle()
.pipe(source('bundle.js'))
.pipe(buff())
.pipe($.uglify())
.pipe(gulp.dest('dest/scripts'));
});
/* Do not use vinyl-transform https://github.com/substack/node-browserify/issues/1191 */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.