-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
52 lines (48 loc) · 1.29 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
49
50
51
52
"use strict";
var gulp = require('gulp');
var traceur = require('./tasks/traceur');
var sourcemaps = require('gulp-sourcemaps');
var browserify = require('browserify');
var through = require('through2');
var source = require('vinyl-source-stream');
var traceurify = require('./tasks/traceurify');
var derequire = require('gulp-derequire');
var ngAnnotate = require('gulp-ng-annotate');
var buffer = require('vinyl-buffer');
var uglify = require('gulp-uglify');
gulp.task('build:prod:js', function () {
return browserify()
.add(traceur.RUNTIME_PATH)
.add('./src/js/index.js')
.transform(traceurify())
.bundle()
.pipe(source('index.js'))
.pipe(buffer())
.pipe(uglify({
compress: {
dead_code: true,
properties: true,
sequences: true,
drop_debugger: true,
conditionals: true,
unused: true,
join_vars: true,
drop_console: true
}
}))
.pipe(ngAnnotate())
.pipe(gulp.dest('./dist/'))
})
gulp.task('build:dev:js', function () {
gulp.src('src/js/**/*.js')
.pipe(sourcemaps.init())
.pipe(traceur({
experimental: true,
modules: 'amd'
}))
.pipe(sourcemaps.write())
.pipe(gulp.dest('src/tmp'))
});
gulp.task('watch', function () {
gulp.watch('src/js/**/*.*', ['build:dev:js'])
});