forked from hoveytechllc/ngx-power-table
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpFile.js
61 lines (52 loc) · 1.49 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
54
55
56
57
58
59
60
61
var gulp = require('gulp');
var Builder = require("systemjs-builder");
var rename = require('gulp-rename');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var ts = require('gulp-typescript');
var distDir = 'bundles';
var distJs = distDir + '/ng2-power-table.js';
var minifiedJs = 'ng2-power-table.min.js';
gulp.task('bundle', function (cb) {
// SystemJS build options.
var options = {
normalize: true,
runtime: false,
sourceMaps: true,
sourceMapContents: true,
minify: false,
mangle: false,
externals: [
'@angular/core',
'@angular/common'
]
};
var builder = new Builder('./');
builder.config({
paths: {
'ng2-power-table/ng2-power-table': 'ng2-power-table.js',
'ng2-power-table/src/*': 'src/*.js'
},
packages: {
'src' : {defaultExtension: 'js'}
}
});
builder.bundle('ng2-power-table/ng2-power-table', distJs, options)
.then(function () {
console.log('bundle succeeded.');
cb();
})
.catch(function (e) {
console.log('bundle failed. Error: ' + e);
cb();
});
});
gulp.task('minify', ['bundle'], function () {
gulp.src(distJs)
.pipe(rename(minifiedJs))
.pipe(uglify())
.pipe(gulp.dest(distDir));
console.log('minify complete.');
});
gulp.task('build', ['bundle', 'minify'], function () {
});