I am currently setting up my gulpfile and im having a problem with gulp-sass when the watch task is running the scss task.
This is how my gulpfile.js looks:
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
sass = require('gulp-sass'),
sourcemaps = require('gulp-sourcemaps');
var onError = function(err) {
console.log(err);
};
var bases = {
dist: './dist/',
src: './src/'
};
var paths = {
sass: [bases.src + 'scss/base.scss'],
sourcemaps: '/'
};
gulp.task('scss', function(){
return gulp.src(paths.sass)
.pipe(plumber({
errorHandler: onError
}))
.pipe(sourcemaps.init())
.pipe(sass({
sourcemap: true,
style: 'expanded',
sourceComments: 'normal',
onError: onError
}))
.pipe(sourcemaps.write(paths.sourcemaps))
.pipe(gulp.dest(bases.dist + 'css/'))
});
gulp.task('watch', function(){
gulp.watch(bases.src + 'scss/**/*.scss', ['scss'])
});
gulp.task('default', ['scss','watch']);
base.scss only contains this: (also tried full path and without fileext. same result)
@import 'modules/modules_base.scss';
The error i'm getting in console:
[18:54:13] Finished 'scss' after 12 ms
[18:54:15] Starting 'scss'...
{ [Error: src\scss\base.scss
1:9 file to import not found or unreadable: ./src/scss/modules/modules_base.scss
Current dir: ]
message: 'src\\scss\\base.scss\n 1:9 file to import not found or unreadable: ./src/scss/modules/modules_base.scss\nCurrent dir: ',
column: 9,
line: 1,
file: 'stdin',
status: 1,
messageFormatted: '\u001b[4msrc\\scss\\base.scss\u001b[24m\n\u001b[90m 1:9\u001b[39m file to import not found or unreadable: ./src/scss/modules/modules_base.scss\nCurrent dir: ',
name: 'Error',
stack: 'Error: src\\scss\\base.scss\n 1:9 file to import not found or unreadable: ./src/scss/modules/modules_base.scss\nCurrent dir: \n at options.error (c:\\Code\\colorpicker\\node_modules\\gu
lp-sass\\node_modules\\node-sass\\lib\\index.js:276:32)',
showStack: false,
showProperties: true,
plugin: 'gulp-sass' }
The basic error is: 1:9 File to import not found or unreadable: ./src/scss/modules/modules_base.scss
the structure of the app:
-component
gulpfile.js
-dist
-css
base.css
base.css.map
-src
-scss
base.scss
-modules
-modules_base.scss
The error only happens when i save the modules_base.scss and the watch task is fired, and never when im running the default task.
all suggestions are appreciated!
Notes: Node -v : 0.12.0 Gulp: 3.8.11 gulp-sass: 2.0.1