Created
March 29, 2016 11:29
-
-
Save abhilashsajeev/cec6716b5c158d9dbe32 to your computer and use it in GitHub Desktop.
Gulp file for react build
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
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var source = require('vinyl-source-stream'); | |
var buffer = require('vinyl-buffer'); | |
var browserify = require('browserify'); | |
var bundler = browserify('./index.js'); | |
bundler.transform('babelify', {presets: ["es2015", "react"]}) | |
gulp.task('browserify', bundle); | |
function bundle() { | |
return bundler.bundle() | |
// log errors if they happen | |
.on('error', gutil.log.bind(gutil, 'Browserify Error')) | |
.pipe(source('dist.js')) | |
.pipe(buffer()) | |
// .pipe(uglify()) | |
.pipe(gulp.dest('./dist')) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment