-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.babel.js
82 lines (72 loc) · 1.65 KB
/
gulpfile.babel.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
import {
gulp,
plugins,
args,
dirs,
jsWatch,
join,
} from './gulp/config/shared-vars';
import './gulp/tasks/browserSync';
import './gulp/tasks/bump';
import './gulp/tasks/clean';
import './gulp/tasks/eslint';
import './gulp/tasks/icomoon-unpackager';
import './gulp/tasks/imagemin';
import './gulp/tasks/modernizr';
import './gulp/tasks/new';
import './gulp/tasks/pug';
import './gulp/tasks/sass';
import { scripts_task } from './gulp/tasks/scripts';
import './gulp/tasks/symbolize-svgs';
import './gulp/tasks/watch';
var clean = args.production ? gulp.series('clean', 'clean:livesite') : 'clean';
// Compiles all the code
gulp.task(
'compile',
gulp.parallel(
'copy',
'pug',
scripts_task,
'imagemin',
'symbolize-svgs',
'sass',
'modernizr'
)
);
let user_used_serve = false;
gulp.task('serve', () => {
user_used_serve = true;
gulp.start('default');
});
// Testing
gulp.task('test', gulp.series('eslint'));
const enable_js_watch = (done) => {
jsWatch.isEnabled = true;
done();
};
const warn_not_to_use_serve_command = (done) => {
if (user_used_serve) {
// User friendly message for Yeogurt users who are used to running "gulp serve"
setTimeout(() => {
console.log(
`\n Just use "${plugins.util.colors.bold.green(
'gulp'
)}" rather than "${plugins.util.colors.bold.red('gulp serve')}" \n`
);
}, 2000);
}
};
// Default task (cleans and builds then runs server then watches for changes)
gulp.task(
'default',
gulp.series(
clean,
enable_js_watch,
'clean:pages:empty',
'compile',
'watch',
warn_not_to_use_serve_command
)
);
//Cleans and builds only with no server
gulp.task('build', gulp.series(clean, 'compile'));