-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgulpfile.babel.js
70 lines (61 loc) · 1.23 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
'use strict'
import gulp from 'gulp'
import glob from 'glob'
import { args } from './gulp/utils'
import { npm_postPublish_clean } from './gulp/tasks/clean'
import {
npm_rollup_auto_CJS,
npm_rollup_index_CJS,
npm_rollup_supportsTime,
} from './gulp/tasks/rollup'
// This will grab all js in the `gulp` directory
// in order to load all gulp tasks
glob.sync('./gulp/tasks/**/*.js')
.filter(function (file) {
return /\.(js)$/i.test(file)
})
.map(function (file) {
require(file)
})
const production_mode_on = (done) => {
args.production = true
done()
}
// Build production-ready code
gulp.task(
'build',
gulp.series(
production_mode_on,
gulp.parallel('copy', 'imagemin', 'pug', 'sass', 'rollup'),
'rev'
)
)
// Server tasks with watch
gulp.task(
'serve',
gulp.series(
gulp.parallel(
'imagemin',
'copy',
'pug',
'sass',
'rollup',
'browserSync',
'watch'
)
)
)
// Default task
gulp.task('default', gulp.series('clean', args.production ? 'build' : 'serve'))
// Testing
gulp.task('test', gulp.series('eslint'))
// NPM publishing
gulp.task(
'pre-publish',
gulp.parallel(
npm_rollup_supportsTime,
npm_rollup_index_CJS,
npm_rollup_auto_CJS
)
)
gulp.task('post-publish', gulp.parallel(npm_postPublish_clean))