I ran npm update
today, and what followed is a disaster. I had trouble getting packages to install, but after everything appeared to be in the right place, I started up my gulp
task that compiles my SCSS code into CSS.
This code reproduces my issue:
var gulp = require('gulp'),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass');
gulp.task('sass', function() {
gulp.src('www/sass/*.scss')
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('www/css'));
});
gulp.task('default', ['sass'], function(){
gulp.watch('www/sass/*.scss', {debounceDelay: 2000}, ['sass']);
});
After running this piece of code via gulp default
, this is the result:
www/sass/example.scss
#test {
color: red;
}
www/css/example.css
#test {
color: red; }
/*# sourceMappingURL=example.css.map */
www/css/example.css.map
{"version":3,"sources":["../../stdin"],"names":[],"mappings":"AAAA,KAAK,CAAC;EACL,KAAK,EAAE,GAAI,GACX","file":"example.css","sourceRoot":"/sass"}
The sources
array in the generated source map contains "../../stdin/"
instead of "example.scss"
! But why?