-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
47 lines (41 loc) · 1011 Bytes
/
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
const config = require('./gulp/config')
const gulp = require('gulp')
const prod = config.production
const common = [
'fonts', 'markup',
'scripts', 'static',
'styles'
]
const development = [
'serve', 'watch'
]
const production = [
'minifyStyles',
'purge',
'styles-production', 'zip'
]
common.forEach(file => require(`./gulp/common/${file}`))
prod
? production.forEach(file => require(`./gulp/production/${file}`))
: development.forEach(file => require(`./gulp/development/${file}`))
const prodTasks = [
'minifyStyles',
'purge',
'zip',
]
let tasks = [
'clean',
config.production ? 'styles:prod' : 'styles',
'images', 'head',
'scripts', 'fonts',
'markup',
prod && [...prodTasks]
]
const filteredTasks = tasks.filter(task => !!task)
gulp.task('build', gulp.series(...filteredTasks))
if (prod) {
gulp.task('release', gulp.series('build', 'zip'))
} else {
gulp.task('serve', gulp.parallel('browser-sync', 'watch'))
gulp.task('default', gulp.series('build', 'serve'))
}