Reputation: 619
I have two tasks in my Gulp file:
I've told Gulp that task #2 requires task #1.
When I run task #2, the files are created for task #1, but the files that should be created for task #2 are not. If I run task #2 again, then the files for task #2 are created.
I'm thinking there's some sort of cache Gulp is using, and since the files didn't exist when Gulp first ran, it isn't finding them and therefore not doing anything with them.
I've tried searching around to no avail. Any thoughts or suggestions would be great!
var gulp = require('gulp'),
less = require('gulp-less'),
csso = require('gulp-csso');
gulp.task( 'default', ['styles-dev'], function() {} );
gulp.task( 'prepare', ['minify-css'], function() {} )
gulp.task('styles-dev', function() {
gulp
.src("source/styles/global*.less")
.pipe( less({
sourceMap: true
}) )
.pipe( gulp.dest("build/local/styles") )
});
gulp.task('minify-css', ['styles-dev'], function() {
gulp.src('build/local/styles/*.css')
.pipe(csso())
.pipe(gulp.dest('build/pre/styles'))
});
Upvotes: 0
Views: 439
Reputation: 13205
var gulp = require('gulp'),
less = require('gulp-less'),
csso = require('gulp-csso');
gulp.task( 'default', ['css']);
gulp.task('css', function() {
return gulp.src("source/styles/global*.less")
.pipe( less({
sourceMap: true
}) )
.pipe(gulp.dest("build/local/styles"))
.pipe(csso())
.pipe(gulp.dest('build/pre/styles'));
});
Upvotes: 0
Reputation: 619
gulp.task('styles-dev', function() {
return gulp
.src("source/styles/global*.less")
.pipe( less({
sourceMap: true
}) )
.pipe( gulp.dest("build/local/styles") )
});
Looks like I need to return the stream as a "hint" that the task is finished. It's amazing how asking a question will help you find the answer...
Upvotes: 1