Skip to content

Instantly share code, notes, and snippets.

@abhilashsajeev
Created March 29, 2016 11:29
Show Gist options
  • Save abhilashsajeev/cec6716b5c158d9dbe32 to your computer and use it in GitHub Desktop.
Save abhilashsajeev/cec6716b5c158d9dbe32 to your computer and use it in GitHub Desktop.
Gulp file for react build
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