I've got this gulp file
const gulp = require('gulp')
const sass = require('gulp-sass')
const cleanCSS = require('gulp-clean-css')
const rimraf = require('rimraf')
const concat = require('gulp-concat')
gulp.task('clean', function(cb) {
rimraf('./dist/*', cb)
})
gulp.task('sass', function(cb) {
gulp.src('./src/**/*.scss')
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError))
.pipe(gulp.dest('./dist'))
console.log('before')
cb(undefined)
})
gulp.task('minify', function(cb) {
gulp.src('./src/**/*.css')
.pipe(cleanCSS())
.pipe(gulp.dest('./dist'))
console.log('before')
cb(undefined)
})
gulp.task('build:css', ['sass', 'minify'], function() {
gulp.src('./dist/**/*.css')
.pipe(concat('style.min.css'))
.pipe(gulp.dest('./dist'))
console.log('after')
})
gulp.task('build', ['clean'], function() {
gulp.start('build:css')
})
gulp.task('build:watch', function () {
gulp.watch('./src/**/*.scss', ['build'])
})
But when I run build:watch
[11:26:18] Using gulpfile C:\dev\web\ikea_design\gulpfile.js
[11:26:18] Starting 'build:watch'...
[11:26:18] Finished 'build:watch' after 16 ms
[11:26:24] Starting 'clean'...
[11:26:24] Finished 'clean' after 11 ms
[11:26:24] Starting 'build'...
[11:26:24] Starting 'sass'...
before
[11:26:24] Finished 'sass' after 12 ms
[11:26:24] Starting 'minify'...
before
[11:26:24] Finished 'minify' after 2.27 ms
[11:26:24] Starting 'build:css'...
after
[11:26:24] Finished 'build:css' after 1.16 ms
[11:26:24] Finished 'build' after 25 ms
even if it displays the two befores before the after, style.css.min
doesn't get created. That's strange since the css files should have already been saved in the dist
folder by the time concat
gets invoked.
What's wrong?
Edit
I've run gulp-debug inside of build:css
and it shows 0 items in the pipe