diff --git a/tasks/build/css.js b/tasks/build/css.js index 137d11724..75f43a6e5 100644 --- a/tasks/build/css.js +++ b/tasks/build/css.js @@ -21,6 +21,7 @@ var print = require('gulp-print'), rename = require('gulp-rename'), replace = require('gulp-replace'), + runSequence = require('run-sequence'), // config config = require('../config/user'), @@ -47,7 +48,8 @@ module.exports = function(callback) { var stream, compressedStream, - uncompressedStream + uncompressedStream, + completeCount = 0 ; console.info('Building CSS'); @@ -57,6 +59,12 @@ module.exports = function(callback) { return; } + function complete() { + if (++completeCount === 2) { + callback() + } + } + // unified css stream stream = gulp.src(source.definitions + '/**/' + globs.components + '.less') .pipe(plumber(settings.plumber.less)) @@ -82,7 +90,7 @@ module.exports = function(callback) { .pipe(gulp.dest(output.uncompressed)) .pipe(print(log.created)) .on('end', function() { - gulp.start('package uncompressed css'); + runSequence('package uncompressed css', complete); }) ; @@ -97,8 +105,7 @@ module.exports = function(callback) { .pipe(gulp.dest(output.compressed)) .pipe(print(log.created)) .on('end', function() { - gulp.start('package compressed css'); - callback(); + runSequence('package compressed css', complete); }) ;