Skip to content

Commit 5e48f9d

Browse files
committed
refactor: update gulp interface
1 parent a86ef9e commit 5e48f9d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

gulpfile.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,29 @@ const dist = {
2020
}
2121
}
2222

23-
gulp.task('css', () => {
23+
const styles = () =>
2424
gulp
2525
.src(src.css)
2626
.pipe(concat(`${dist.name.css}.min.css`))
2727
.pipe(prefix())
2828
.pipe(strip({ all: true }))
2929
.pipe(cssnano())
3030
.pipe(gulp.dest(dist.path))
31-
})
3231

33-
gulp.task('js', () => {
32+
const scripts = () =>
3433
gulp
3534
.src(src.js)
3635
.pipe(concat(`${dist.name.js}.min.js`))
3736
.pipe(uglify())
3837
.pipe(gulp.dest(dist.path))
39-
})
4038

41-
gulp.task('build', ['css', 'js'])
39+
const build = gulp.parallel(styles, scripts)
4240

43-
gulp.task('default', () => {
44-
gulp.start(['build'])
45-
gulp.watch(src.css, ['css'])
46-
gulp.watch(src.js, ['js'])
47-
})
41+
function watch () {
42+
gulp.watch(src.css, styles)
43+
gulp.watch(src.js, scripts)
44+
}
45+
46+
module.exports.default = gulp.series(build, watch)
47+
module.exports.build = build
48+
module.exports.watch = watch

0 commit comments

Comments
 (0)