This repository was archived by the owner on Feb 27, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.js
62 lines (55 loc) · 1.87 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
const gulp = require('gulp');
const HubRegistry = require('gulp-hub');
const browserSync = require('browser-sync');
const conf = require('./conf/gulp.conf');
// Load some files into the registry
const hub = new HubRegistry([conf.path.tasks('*.js')]);
// Tell gulp to use the tasks just loaded
gulp.registry(hub);
<% if (modules === 'inject') { -%>
gulp.task('inject', gulp.series(gulp.parallel('styles', 'scripts'), 'inject'));
<% } -%>
gulp.task('build', <%- buildTask %>);
gulp.task('test', <%- testTask %>);
gulp.task('test:auto', <%- testAutoTask %>);
gulp.task('serve', <%- serveTask %>);
gulp.task('serve:dist', gulp.series('default', 'browsersync:dist'));
gulp.task('default', gulp.series('clean', 'build'));
gulp.task('watch', watch);
function reloadBrowserSync(cb) {
browserSync.reload();
cb();
}
function watch(done) {
<% if (modules === 'inject') { -%>
gulp.watch([
conf.path.src('index.html'),
'bower.json'
], gulp.parallel('inject'));
<% } -%>
<% if (framework !== 'react' && modules !== 'webpack') { -%>
<% if (modules !== 'systemjs') { -%>
gulp.watch(conf.path.src('app/**/*.html'), gulp.series('partials', reloadBrowserSync));
<% } else { -%>
gulp.watch(conf.path.src('**/*.html'), reloadBrowserSync);
<% } -%>
<% } else if (modules === 'webpack') {-%>
gulp.watch(conf.path.tmp('index.html'), reloadBrowserSync);
<% } else { -%>
gulp.watch(conf.path.src('index.html'), reloadBrowserSync);
<% } -%>
<% if (modules !== 'webpack') { -%>
gulp.watch([
<% if (css !== 'css') { -%>
conf.path.src('**/*.<%- css %>'),
<% } -%>
conf.path.src('**/*.css')
], gulp.series('styles'));
<% } -%>
<% if (modules === 'inject') { -%>
gulp.watch(conf.path.src('**/*.<%- extensions.js %>'), gulp.series('inject'));
<% } else if (modules === 'systemjs') { -%>
gulp.watch(conf.path.src('**/*.<%- extensions.js %>'), gulp.series('scripts'));
<% } -%>
done();
}