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?
This was a bug with node-sass
which was fixed as of gulp-sass
version 2.1.1
. See the related issue on Github
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With