-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
94 lines (77 loc) · 2.89 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
var gulp = require('gulp');
var del = require('del');
var concat = require('gulp-concat');
var srcmaps = require('gulp-sourcemaps');
var ts = require('gulp-typescript');
var tsconfig = require('./tsconfig.json');
var SystemjsBuilder = require('systemjs-builder');
gulp.task('clean:css:lib', function () {
return del('public/css/lib/*');
});
gulp.task('clean:css', function () {
return del([ 'public/css/*', '!public/css/lib' ]);
});
gulp.task('clean:js:lib', function () {
return del('public/js/lib/*');
});
gulp.task('clean:js', function () {
return del([ 'public/js/*', '!public/js/lib' ]);
});
gulp.task('compile:ts:assets', function () {
gulp.src('src/app/**/*.html').pipe(gulp.dest('public/js'));
gulp.src('src/app/**/*.css').pipe(gulp.dest('public/js'));
});
gulp.task('compile:ts', [ 'compile:ts:assets' ], function () {
return gulp.src('src/app/**/*.ts')
.pipe(srcmaps.init())
.pipe(ts(tsconfig.compilerOptions))
.pipe(srcmaps.write('.'))
.pipe(gulp.dest('public/js'));
});
gulp.task('bundle:app', [ 'compile:ts' ], function () {
var builder = new SystemjsBuilder('public', './src/systemjs.config.js');
return builder.buildStatic('app', 'public/js/index.js');
});
gulp.task('bundle:vendor', [ 'copy:vendor' ], function () {
return gulp.src([
'node_modules/jquery/dist/jquery.slim.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'node_modules/core-js/client/shim.min.js',
'node_modules/zone.js/dist/zone.js',
'node_modules/reflect-metadata/Reflect.js',
'node_modules/systemjs/dist/system.src.js',
'node_modules/chart.js/dist/Chart.bundle.min.js',
'src/systemjs.config.js'
])
.pipe(concat('vendors.js'))
.pipe(gulp.dest('public/js/lib'));
});
gulp.task('copy:vendor', function () {
gulp.src('node_modules/@angular/**/*')
.pipe(gulp.dest('public/js/lib/@angular/'));
gulp.src('node_modules/rxjs/**/*')
.pipe(gulp.dest('public/js/lib/rxjs'));
gulp.src('node_modules/ng2-charts/**/*')
.pipe(gulp.dest('public/js/lib/ng2-charts'));
return gulp.src('node_modules/angular-in-memory-web-api/bundles/*')
.pipe(gulp.dest('public/js/lib/angular-in-memory-web-api/bundles'));
});
gulp.task('bundle:css:vendor', function () {
return gulp.src([
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/bootstrap/dist/css/bootstrap-theme.min.css'
])
.pipe(concat('vendors.css'))
.pipe(gulp.dest('public/css/lib'));
});
gulp.task('bundle:css:app', function () {
return gulp.src([
'src/css/**/*'
])
.pipe(concat('estilos.css'))
.pipe(gulp.dest('public/css/'));
});
gulp.task('clean', [ 'clean:js:lib', 'clean:js' ]);
gulp.task('vendor', [ 'copy:vendor', 'bundle:vendor' ]);
gulp.task('app', [ 'compile:ts', 'bundle:app' ]);
gulp.task('default', [ 'vendor', 'app' ]);