javascript - Gulp browserify babel and watchify to output multiple bundles -
i want output multiple bundles using gulp,browserfiy , use feature of babel , watchify.i produce mutliple bundles non wiser use feature of babel , watchify.
here's have done multiple bundling
var gulp = require('gulp'); var minifycss = require('gulp-minify-css'); var uglify = require('gulp-uglify'); var browserify = require('browserify'); var source = require('vinyl-source-stream'); var reactify = require('reactify'); var babel = require('babelify'); var watchify = require('watchify'); var csssrcdir = './css/'; var jssrcdir = './js/react/'; var builddir = './build/'; var distdir = './dist/'; var mapsdir = './maps/'; gulp.task('minify-css',function(){ return gulp.src(csssrcdir + '**/*.css') .pipe(minifycss()) .pipe(gulp.dest(builddir+'/css')) }); gulp.task('uglify',function(){ return gulp.src(jssrcdir + '/**/*.js') .pipe(uglify()) .pipe(gulp.dest(builddir+'/js/')) }); gulp.task('js', function (done) { [ "homepage", "filter", "listing", ].foreach(function (entry, i, entries) { // count remaining bundling operations track // when call done(). alternatively use // merge-stream , return output. entries.remaining = entries.remaining || entries.length; browserify('./js/react/' + entry + '.jsx').transform(babel,reactify) .bundle() .pipe( require('fs').createwritestream(builddir + entry + 'bundle.js') .on('finish', function () { if (! --entries.remaining) done(); }) ); }); }); gulp.task('minify',['minify-css','uglify','js']);
what should enjoy feature of watchify , babel?
Comments
Post a Comment