forked from angular/zone.js
-
Notifications
You must be signed in to change notification settings - Fork 5
/
gulpfile.js
56 lines (44 loc) · 1.46 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
53
'use strict';
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
var distFolder = './dist';
function generateBrowserScript(inFile, outFile) {
var b = browserify({
entries: inFile,
// es6-promise references process for use in node context, but we don't want to include the
// browser version from browserify
insertGlobalVars: {'process': function() { return '{}'; } },
debug: false
});
return b
.bundle()
.pipe(source(outFile))
.pipe(buffer())
.pipe(gulp.dest(distFolder))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest(distFolder));
;
}
gulp.task('build/zone.js', function() {
return generateBrowserScript('./lib/browser/zone.js', 'zone.js');
});
gulp.task('build/zone-microtask.js', function() {
return generateBrowserScript('./lib/browser/zone-microtask.js', 'zone-microtask.js');
});
gulp.task('build/jasmine-patch.js', function() {
return generateBrowserScript('./lib/browser/jasmine-patch.js', 'jasmine-patch.js');
});
gulp.task('build/long-stack-trace-zone.js', function() {
return generateBrowserScript('./lib/browser/long-stack-trace-zone.js', 'long-stack-trace-zone.js');
});
gulp.task('build', [
'build/zone.js',
'build/zone-microtask.js',
'build/jasmine-patch.js',
'build/long-stack-trace-zone.js'
]);