-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
49 lines (42 loc) · 1.36 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
42
43
44
45
46
47
48
'use strict';
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var browserify = require("browserify");
var esdoc = require("gulp-esdoc");
gulp.task('default', function () {
// set up the browserify instance on a task basis
var b = browserify({
entries: './src/app.js',
debug: true,
}).transform("babelify", { presets: ["es2015"] });
return b.bundle()
.pipe(source('./app/app.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dev/'));
});
gulp.task('release', function () {
// set up the browserify instance on a task basis
var b = browserify({
entries: './src/app.js',
}).transform("babelify", { presets: ["es2015"] });
return b.bundle()
.pipe(source('./app/app.js'))
.pipe(buffer())
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', gutil.log)
.pipe(gulp.dest('./dist/'));
});
gulp.task('doc', function () {
return gulp.src('./src').pipe(esdoc({ destination: "./esdoc" }));
});