mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-13 05:55:26 +00:00
update
This commit is contained in:
54
node_modules/bs-recipes/recipes/gulp.browserify/gulpfile.js
generated
vendored
Normal file
54
node_modules/bs-recipes/recipes/gulp.browserify/gulpfile.js
generated
vendored
Normal file
@ -0,0 +1,54 @@
|
||||
var gulp = require('gulp');
|
||||
var gutil = require('gulp-util');
|
||||
var source = require('vinyl-source-stream');
|
||||
var babelify = require('babelify');
|
||||
var watchify = require('watchify');
|
||||
var exorcist = require('exorcist');
|
||||
var browserify = require('browserify');
|
||||
var browserSync = require('browser-sync').create();
|
||||
|
||||
// Watchify args contains necessary cache options to achieve fast incremental bundles.
|
||||
// See watchify readme for details. Adding debug true for source-map generation.
|
||||
watchify.args.debug = true;
|
||||
// Input file.
|
||||
var bundler = watchify(browserify('./app/js/app.js', watchify.args));
|
||||
|
||||
// Babel transform
|
||||
bundler.transform(babelify.configure({
|
||||
sourceMapRelative: 'app/js'
|
||||
}));
|
||||
|
||||
// On updates recompile
|
||||
bundler.on('update', bundle);
|
||||
|
||||
function bundle() {
|
||||
|
||||
gutil.log('Compiling JS...');
|
||||
|
||||
return bundler.bundle()
|
||||
.on('error', function (err) {
|
||||
gutil.log(err.message);
|
||||
browserSync.notify("Browserify Error!");
|
||||
this.emit("end");
|
||||
})
|
||||
.pipe(exorcist('app/js/dist/bundle.js.map'))
|
||||
.pipe(source('bundle.js'))
|
||||
.pipe(gulp.dest('./app/js/dist'))
|
||||
.pipe(browserSync.stream({once: true}));
|
||||
}
|
||||
|
||||
/**
|
||||
* Gulp task alias
|
||||
*/
|
||||
gulp.task('bundle', function () {
|
||||
return bundle();
|
||||
});
|
||||
|
||||
/**
|
||||
* First bundle, then serve from the ./app directory
|
||||
*/
|
||||
gulp.task('default', ['bundle'], function () {
|
||||
browserSync.init({
|
||||
server: "./app"
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user