Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sourcemap "sources" array links to "../../stdin" instead of actual SCSS file

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?

like image 440
SeinopSys Avatar asked Nov 29 '15 19:11

SeinopSys


1 Answers

This was a bug with node-sass which was fixed as of gulp-sass version 2.1.1. See the related issue on Github

like image 103
SeinopSys Avatar answered Nov 15 '22 13:11

SeinopSys