Gulp-minify-css does not produce output files -


i have set simple gulpfile.js there 2 task - 'sass' , 'minify-js'. these 2 tasks fired task 'watch' when change detected. seems working well: gulp listening changes, *.scss files compiled css, console generates output expected, without errors. however, css files not minified there no output files 'minify-css' task whatsoever.

why 'minify-css' not working? missing here?

this gulpfile.js:

var gulp = require('gulp'); var sass = require('gulp-sass'); var watch = require('gulp-watch'); var minifycss = require('gulp-minify-css');  gulp.task('sass', function() {     gulp.src('plugins/sosensational/styles/sass/*.scss')             .pipe(sass())             .pipe(gulp.dest('plugins/sosensational/styles/dest/')); });  gulp.task('minify-css', function() {     gulp.src('plugins/sosensational/styles/dest/*.css')             .pipe(minifycss())             .pipe(gulp.dest('plugins/sosensational/styles/dest/')); });  gulp.task('watch', function() {     gulp.watch('plugins/sosensational/styles/sass/*.scss', ['sass', 'minify-css']); }); 

sounds race condition. sass , minifycss executed in parallel, might sass task isn't done when you're running minifycss. sass should dependency, have 2 options:

  1. make sass dependency minifycss:

    gulp.task('minify-css', ['sass'], function() {     return gulp.src('plugins/sosensational/styles/dest/*.css')         .pipe(minifycss())         .pipe(gulp.dest('plugins/sosensational/styles/dest/')); });  gulp.task('watch', function() {      gulp.watch('plugins/sosensational/styles/sass/*.scss', ['minify-css']); }); 
  2. have 1 task both!

    gulp.task('sass', function() {      return gulp.src('plugins/sosensational/styles/sass/*.scss')          .pipe(sass())          .pipe(minifycss())          .pipe(gulp.dest('plugins/sosensational/styles/dest/')); }); 

the latter 1 preferred version. save lot of time if don't have intermediate result

btw: don't forget return statements


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -