-
Notifications
You must be signed in to change notification settings - Fork 154
/
gulpfile.js
86 lines (77 loc) · 2.32 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
var gulp = require('gulp');
var connect = require('gulp-connect');
var manifest = require('gulp-manifest');
gulp.task('html', function(){
return gulp.src(['app/**/*.html', '!app/vendor/**/*'])
.pipe(connect.reload())
.pipe(gulp.dest('build/'))
});
gulp.task('css', function(){
return gulp.src(['app/**/*.css', '!app/vendor/**/*'])
.pipe(connect.reload())
.pipe(gulp.dest('build/'))
});
gulp.task('js', function(){
return gulp.src(['app/**/*.js', '!app/vendor/**/*'])
.pipe(connect.reload())
.pipe(gulp.dest('build/'))
});
gulp.task('assets', function(){
return gulp.src('app/assets/*')
.pipe(connect.reload())
.pipe(gulp.dest('build/assets'))
});
gulp.task('connect', function() {
connect.server({
root: 'build',
livereload: true
});
});
gulp.task('vendor', function() {
return gulp.src([
'app/vendor/**/dist/jquery.js',
'app/vendor/**/angular.js',
'app/vendor/**/angular-route.js',
'app/vendor/**/angular-material.css',
'app/vendor/**/angular-animate.js',
'app/vendor/**/angular-aria.js',
'app/vendor/**/angular-material.js',
'app/vendor/**/angular-moment.js',
'app/vendor/**/ngStorage.js',
'app/vendor/**/app/angular.audio.js',
'app/vendor/**/moment.js',
'app/vendor/**/md-data-table.js',
'app/vendor/**/md-data-table.css',
'app/vendor/**/dist/chart.js',
'app/vendor/**/dist/angular-chart.js',
'node_modules/**/d3.js',
'node_modules/**/LineChart.js',
'node_modules/**/LineChart.css',
'node_modules/**/randomColor.js',
'app/vendor/**/lodash.js',
'app/vendor/**/page_visibility.js'
])
.pipe(gulp.dest('build/vendor'))
});
gulp.task('watch', function () {
gulp.watch(['./app/**/*.html'], ['html', 'manifest']);
gulp.watch(['./app/**/*.css'], ['css', 'manifest']);
gulp.watch(['./app/**/*.js'], ['js', 'manifest']);
gulp.watch(['./assets/*.*'], ['assets', 'manifest']);
});
gulp.task('manifest', function(){
gulp.src([
'build/**/*'
], { base: './build' })
.pipe(manifest({
hash: true,
preferOnline: true,
network: ['*'],
filename: 'app.manifest',
exclude: 'app.manifest'
}))
.pipe(connect.reload())
.pipe(gulp.dest('build'));
});
gulp.task('build', [ 'html', 'css', 'js', 'assets', 'vendor', 'manifest' ]);
gulp.task('default', [ 'build', 'connect', 'watch' ]);