ci: split some gulp watches

This commit is contained in:
Bobby Wibowo 2022-06-24 09:22:32 +07:00
parent 3dd056d8f3
commit cd77bddd86
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -40,18 +40,11 @@ if (process.env.NODE_ENV !== 'development') {
/** TASKS: LINT */
gulp.task('lint:sass', () => {
return gulp.src('./src/**/*.scss')
.pipe(stylelint({
failAfterError: true,
reporters: [{ formatter: 'string', console: true }]
}))
})
gulp.task('lint:css', () => {
return gulp.src('./src/**/*.css', {
ignore: './src/libs/**/*'
})
gulp.task('lint:style', () => {
return gulp.src([
'./src/**/*.css',
'./src/**/*.scss'
])
.pipe(stylelint({
failAfterError: true,
reporters: [{ formatter: 'string', console: true }]
@ -76,12 +69,12 @@ gulp.task('lint:js', () => {
// the other one won't exit prematurely (this is a bit awkward).
// https://github.com/gulpjs/gulp/issues/1487#issuecomment-466621047
gulp._settle = true
gulp.task('lint', gulp.parallel('lint:sass', 'lint:css', 'lint:js'))
gulp.task('lint', gulp.parallel('lint:style', 'lint:js'))
gulp._settle = false
/** TASKS: CLEAN */
gulp.task('clean:css', () => {
gulp.task('clean:style', () => {
return del([
`${dist}/**/*.css`,
`${dist}/**/*.css.map`
@ -101,7 +94,7 @@ gulp.task('clean:rest', () => {
])
})
gulp.task('clean', gulp.parallel('clean:css', 'clean:js', 'clean:rest'))
gulp.task('clean', gulp.parallel('clean:style', 'clean:js', 'clean:rest'))
/** TASKS: BUILD */
@ -162,35 +155,48 @@ gulp.task('default', gulp.series('lint', 'clean', 'build', 'exec:bump-versions')
/** TASKS: WATCH (SKIP LINTER) */
gulp.task('watch:scss', () => {
return gulp.watch([
'src/**/*.scss'
], gulp.series('build:sass'))
})
gulp.task('watch:css', () => {
return gulp.watch([
'src/**/*.css',
'src/**/*.scss'
], gulp.series('clean:css', 'build:sass', 'build:css', 'build:fontello'))
'src/**/*.css'
], {
ignored: [
'src/libs/fontello/fontello.css'
]
}, gulp.series('build:css'))
})
gulp.task('watch:fontello', () => {
return gulp.watch([
'src/libs/fontello/fontello.css'
], gulp.series('build:fontello'))
})
gulp.task('watch:js', () => {
return gulp.watch([
'src/**/*.js'
], gulp.series('clean:js', 'build:js'))
], gulp.series('build:js'))
})
gulp.task('watch:src', gulp.parallel('watch:css', 'watch:js'))
gulp.task('watch:src', gulp.parallel('watch:css', 'watch:scss', 'watch:fontello', 'watch:js'))
gulp.task('nodemon', cb => {
return nodemon({
script: './lolisafe.js',
env: process.env,
watch: [
'lolisafe.js',
'logger.js',
'config.js',
'controllers/',
'database/',
'routes/',
'views/_globals.njk',
'views/_layout.njk',
'views/album.njk'
'views/album.njk',
'config.js',
'logger.js',
'lolisafe.js'
],
ext: 'js',
done: cb