-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
41 lines (34 loc) · 1.01 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
var gulp = require('gulp'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify'),
babelify = require('babelify'),
browserify = require('browserify'),
sourcemaps = require('gulp-sourcemaps');
function bundle(bundler, filename) {
return bundler
.transform(babelify)
.bundle()
.on('error', function (err) { console.error(err.stack); })
.pipe(source(filename))
.pipe(buffer())
// .pipe(sourcemaps.init({ loadMaps: true }))
// .pipe(uglify()) // Use any gulp plugins you want now
// .pipe(sourcemaps.write('.'))
}
gulp.task('pack', function () {
var bundler = browserify({
entries: './public/discussion/index.js',
debug: true
});
return bundle(bundler, 'bundle.js')
.pipe(gulp.dest('./public/discussion'));
});
gulp.task('dive', function() {
var bundler = browserify({
entries: './public/logicdive/index.js',
debug: true
});
return bundle(bundler, 'bundle.js')
.pipe(gulp.dest('./public'));
});