My gulpfile is adding the compiled css and js files to both the dest (css / js) folders and the src (scss / coffee) folders.
The desired outcome is that the compiled files only print to the dest folders.
This is only happening when running gulp on Windows and not on Mac. Also, if I run the tasks without the watch, it compiles correctly; 'gulp styles' compiles the css files only to the css folder - 'gulp scripts' compiles the js files only to the js folder.
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
autoprefixer = require('gulp-autoprefixer'),
coffee = require('gulp-coffee'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
minifycss = require('gulp-minify-css'),
sass = require('gulp-sass');
gulp.task('styles', function () {
return gulp.src(['scss/**/*.scss'])
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}
}))
.pipe(sass())
.pipe(autoprefixer('last 2 versions'))
.pipe(gulp.dest('css/'))
.pipe(rename({ suffix: '.min' }))
.pipe(minifycss())
.pipe(gulp.dest('css/'))
});
gulp.task('scripts', function () {
return gulp.src('coffee/**/*.coffee')
.pipe(plumber({
errorHandler: function (error) {
console.log(error.message);
this.emit('end');
}
}))
.pipe(coffee({ bare: true }))
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(gulp.dest('js/'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify())
.pipe(gulp.dest('js/'))
});
gulp.task('default', function () {
gulp.watch("scss/**/*.scss", ['styles']);
gulp.watch("coffee/**/*.coffee", ['scripts']);
});