-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
61 lines (53 loc) · 1.3 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
// gulp
const gulp = require('gulp');
// import tasks
const styles = require('./tasks/styles');
const scripts = require('./tasks/scripts');
const icons = require('./tasks/icons');
const images = require('./tasks/images');
const copy = require('./tasks/copy');
const clean = require('./tasks/clean');
const server = require('./tasks/browserSync');
const paths = require('./tasks/paths');
// Watch files
const watchFiles = () => {
// watch style files
gulp.watch(
paths.watch.sass,
gulp.series(styles.build, server.reload)
);
// watch script files
gulp.watch(
paths.watch.js,
gulp.series(scripts.lint, scripts.build, server.reload)
);
// watch icon files
gulp.watch(
paths.watch.svg,
gulp.series(clean.icons, icons.build, server.reload)
);
// watch image files
gulp.watch(
paths.watch.img,
gulp.series(clean.img, images.optimise, server.reload)
);
// watch font files
gulp.watch(
paths.watch.font,
gulp.series(clean.font, copy.fonts, server.reload)
);
};
// define tasks
const build = gulp.series(
clean.dist,
gulp.parallel(
styles.build,
gulp.series(scripts.lint, scripts.build),
icons.build,
images.optimise,
copy.fonts
),
gulp.parallel(watchFiles, server.init)
);
// expose tasks to CLI
exports.default = build;