javascript - How to make Gulp complete one task, and only then start the next one -


i've set simple gulp tasks process css files.

the tasks put in 1 'master' task:

gulp.task('process-css', ['concatcss', 'minifycss', 'renamecss']);

just reference, definition of concrete tasks follows:

gulp.task('minifycss', function() {     return gulp.src('themes/my_theme/css/dist/*.css')         .pipe(sourcemaps.init())         .pipe(minifycss())         .pipe(sourcemaps.write('./'))         .pipe(gulp.dest('themes/my_theme/css/dist/')); });  gulp.task('concatcss', function() {      var files = [         'themes/rubbish_taxi/css/bootstrap.css',         'themes/rubbish_taxi/css/custom.css',         'themes/rubbish_taxi/css/responsive.css',         'themes/rubbish_taxi/css/jquery.fancybox.css'     ];      return gulp.src(files)         .pipe(concat("bundle.css"))         .pipe(gulp.dest('themes/my_theme/css/dist/')); });  gulp.task('renamecss', function() {     gulp.src('themes/my_theme/css/dist/bundle.css')         .pipe(rename(function(path) {             path.basename += ".min";         }))         .pipe(gulp.dest("themes/my_theme/css/")); }); 

the tasks complete without error, problem minifycss not minify source file. unminified version of files saved bundle.min.css. believe reason minifycss runs before concatcss completed.

how can make tasks executed synchronously? option specify tasks should executed before give task this:

gulp.task('minifycss', ['concatcss'], function() {..} ?

it worked when set way, wanted avoid make code more readable.

gulp.task('minifycss', ['concatcss'], function() {..} ?

it worked when set way, wanted avoid make code more readable.

more readable how? you're stating minifycss dependent on concatcss. line of code quoted above how explain dependency gulp.

the alternative use run-sequence, think avoiding functionality built tool solve exact problem you're facing isn't justified desire subjective improvement in readability.


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -