-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
42 lines (37 loc) · 1.09 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
'use strict';
var babelify = require('babelify');
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var gutil = require('gulp-util');
var browserifyConfig = {
entries: './src/set-functions.js',
debug: true,
standalone: 'SetFunctions',
transform: [babelify]
};
gulp.task('uglified', function () {
return browserify(browserifyConfig)
.bundle()
.pipe(source('set-functions.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/js/'));
});
gulp.task('non-uglified', function () {
return browserify(browserifyConfig)
.bundle()
.pipe(source('set-functions.js'))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/js/'))
});
gulp.task('default', ['uglified', 'non-uglified']);