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

1

6

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?

Anesthetic answered 29/11, 2015 at 19:50 Comment(1)
The issue appears to be a bug with no response from the developer yet: github.com/dlmanning/gulp-sass/issues/394Anesthetic
A
2

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

Anesthetic answered 12/12, 2015 at 10:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.