-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.babel.js
22 lines (21 loc) · 933 Bytes
/
gulpfile.babel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var gulp = require('gulp');
var browserify = require('browserify');
var gutil = require('gulp-util');
var tap = require('gulp-tap');
var buffer = require('gulp-buffer');
var sourcemaps = require('gulp-sourcemaps');
gulp.task('sets', function () {
return gulp.src('src/engine/cards/sets/**/set.js', {read: false}) // no need to read file because browserify does it
// transform file objects using gulp-tap plugin
.pipe(tap(function (file) {
gutil.log('bundling ' + file.path);
// replace file contents with browserify's bundle stream
file.contents = browserify(file.path, {debug: true}).bundle();
}))
// transform streaming contents into buffer contents (because gulp-sourcemaps does not support streaming contents)
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// .pipe(uglify())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('src/simplefrontend/js/bundles'));
});