-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
73 lines (62 loc) · 1.72 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
'use strict'
require('module-alias/register')
// gulp
const gulp = require('gulp')
// import tasks
const taskTemplates = require('@pxlayer/tasks/templates')
const taskStyles = require('@pxlayer/tasks/styles')
const taskScripts = require('@pxlayer/tasks/scripts')
const taskIcons = require('@pxlayer/tasks/icons')
const taskImages = require('@pxlayer/tasks/images')
const taskCopy = require('@pxlayer/tasks/copy')
const taskClean = require('@pxlayer/tasks/clean')
const browserSync = require('@pxlayer/tasks/browserSync')
const paths = require('@pxlayer/tasks/paths')
// Watch files
const watchFiles = () => {
// watch template files
gulp.watch(
paths.watch.template,
gulp.series(taskClean.template, taskTemplates.build, browserSync.reload)
)
// watch style files
gulp.watch(
paths.watch.sass,
gulp.series(taskStyles.build, browserSync.reload)
)
// watch script files
gulp.watch(
paths.watch.js,
gulp.series(taskScripts.lint, taskScripts.build, browserSync.reload)
)
// watch icon files
gulp.watch(
paths.watch.svg,
gulp.series(taskClean.icons, taskIcons.build, browserSync.reload)
)
// watch image files
gulp.watch(
paths.watch.img,
gulp.series(taskClean.img, taskImages.optimise, browserSync.reload)
)
// watch font files
gulp.watch(
paths.watch.font,
gulp.series(taskClean.font, taskCopy.fonts, browserSync.reload)
)
}
// define tasks
const build = gulp.series(
taskClean.dist,
gulp.parallel(
taskTemplates.build,
taskStyles.build,
gulp.series(taskScripts.lint, taskScripts.build),
taskIcons.build,
taskImages.optimise,
taskCopy.fonts
),
gulp.parallel(watchFiles, browserSync.init)
)
// expose tasks to CLI
exports.default = build