sass - Gulp puts file in wrong directory second time it runs -


i'm having strange problem gulp. here gulp file:

var gulp = require('gulp'); var autoprefixer = require('gulp-autoprefixer'); var notify = require('gulp-notify'); var sass = require('gulp-ruby-sass');  gulp.task('default', function() {     gulp.run('main');      gulp.watch('sass/*.scss', function() {         gulp.run('main');     }) });   gulp.task('main', function() {     return gulp.src('sass/**/*.scss')         .pipe(sass())         .on('error', notify.onerror(function(error) { return 'error: ' + error.message; }))         // .pipe(autoprefixer('last 10 version'))         .pipe(gulp.dest('./css'))         .pipe(notify({ message: 'your sass has been auto-prefixed , minified.'}))     ; }); 

the script runs correctly first time. on second , subsequent runs of same script (without gulp having stopped running), puts in sass directory subitem of .scss file. idea why happening. i'm not sure how debug.

try following code.

it uses correct syntax gulp, replacing gulp.run() supported function arguments.

var gulp = require('gulp'); var autoprefixer = require('gulp-autoprefixer'); var notify = require('gulp-notify'); var sass = require('gulp-ruby-sass');     gulp.task('main', function() {   return gulp.src('./sass/**/*.scss')     .pipe(sass())     .on('error', notify.onerror(function(error) { return 'error: ' + error.message; }))     .pipe(gulp.dest('./css'))     .pipe(notify({ message: 'your sass has been auto-prefixed , minified.'})); });  gulp.watch('sass/*.scss', ['main']); gulp.task('default', ['main']); 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -