Last active
February 18, 2016 01:24
-
-
Save mtomcal/e2ea440852e90e6d0cc5 to your computer and use it in GitHub Desktop.
Great React + Browserify Gulpfile
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 browserify = require('browserify'); | |
var watchify = require('watchify'); | |
var streamify = require('gulp-streamify'); | |
var cssMin = require('gulp-css'); | |
var uglify = require('gulp-uglify'); | |
var notify = require('gulp-notify'); | |
var to5ify = require('6to5ify'); | |
var source = require('vinyl-source-stream'); | |
var webserver = require('gulp-webserver'); | |
gulp.task('cssMinfy', function(){ | |
gulp.src('statics/css/*.css') | |
.pipe(cssMin()) | |
.pipe(gulp.dest('dist')); | |
}); | |
gulp.task('browserify', function () { | |
watchify(browserify('src/app.jsx')) | |
.transform(to5ify) | |
.bundle() | |
.on('error', function(err) { | |
console.error(err.message); | |
}) | |
.pipe(source('bundle.js')) | |
.pipe(streamify(uglify('./dist/'))) | |
.pipe(gulp.dest('./dist/')) | |
.pipe(notify("Built Bundle")); | |
}); | |
gulp.task('default', ['browserify']); | |
gulp.task('watch', function () { | |
gulp.src('./') | |
.pipe(webserver({ | |
livereload: true, | |
})); | |
gulp.start('default'); | |
gulp.watch('src/*.jsx', ['default']); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment