-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
44 lines (37 loc) · 916 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
const gulp = require('gulp')
const grun = require('gulp-run')
const webpack = require('webpack-stream')
const webpackConfig = require('./webpack.config.js')
const buildExample = require('./src/tasks/build-example')
// function cleanDist () {
// run('rm -r dist/components/*').exec()
// }
function buildCss () {
return gulp.src('src/style/index.js')
.pipe(webpack(webpackConfig))
.pipe(gulp.dest('dist/'))
}
gulp.task('watch', () => {
gulp.watch('examples/**/*.html').on('change', gulp.parallel(buildExample))
gulp.watch('src/style/**', gulp.series(buildCss))
})
gulp.task('serve', () => {
return run('node index.js').exec()
})
gulp.task('default', callback => {
return gulp.parallel(
'serve',
'build',
'watch'
)(callback)
})
function run (command) {
return grun(command, {
verbosity: 3
})
}
exports.build = gulp.parallel(
// cleanDist,
buildExample,
buildCss
)