/some/path/website/node_modules/source-map/lib/source-map-consumer.js:703
throw new Error('"' + aSource + '" is not in the SourceMap.');
^
Error: "/node_modules/bourbon-neat/app/assets/stylesheets/grid/_box-sizing.scss" is not in the SourceMap.
at SourceMapConsumer_sourceContentFor [as sourceContentFor] (/some/path/website/node_modules/source-map/lib/source-map-consumer.js:703:15)
at SourceMapGenerator.<anonymous> (/some/path/website/node_modules/source-map/lib/source-map-generator.js:229:42)
at Array.forEach (native)
at SourceMapGenerator_applySourceMap [as applySourceMap] (/some/path/website/node_modules/source-map/lib/source-map-generator.js:228:34)
at applySourceMap (/some/path/website/node_modules/vinyl-sourcemaps-apply/index.js:27:15)
at /some/path/website/node_modules/gulp-clean-css/index.js:65:25
at whenSourceMapReady (/some/path/website/node_modules/clean-css/lib/clean.js:139:16)
at /some/path/website/node_modules/clean-css/lib/clean.js:151:18
at fromString (/some/path/website/node_modules/clean-css/lib/utils/input-source-map-tracker.js:33:10)
at InputSourceMapStore.track (/some/path/website/node_modules/clean-css/lib/utils/input-source-map-tracker.js:236:5)
@scniro: I’m experiencing this bug and I have created a minimal project to reproduce it:
https://github.com/arechsteiner/cleancss-bug
In my case, the bug is caused by importing a SCSS file from a third-party npm package like so:
@joaocunha @arechsteiner hey guys thanks for supplying some more info on this one. I’ve been so unusually busy lately and haven’t been as attentive as I’d like looking into these things. Hopefully I’ll get a chance to do so very soon! I’ll keep you all posted if I find anything. Thanks for understanding
@joaocunha I’m taking the day off just to code for fun, so I grabbed your gulp task from your initial post, added in the mods that @scniro mentioned, then added
{sourceRoot: null}
to the first sourcemaps.write() call, and it seemed to work! (At least in my test project.)Okay guys I’ve dug into this a little bit this morning. A bit tricky to pin the blame here, but I think it can be traced back to gulp-sourcemaps. I found this issue which seems to complain of encountering the same problem, which led me down the path of exploring write-options - which has a
sourceRoot
option. Playing with this, I modified the gulp task as such…After implementing this, the error goes away and all seems to work as expected. I forked the error reproduction project supplied by @arechsteiner with the modified task and added a small express server file to glue everything together in the browser, and I can see the styles with the mapping. Can someone check this out when they get time and share your thoughts on if this seems sensible? Thanks all!
@kilianc @arechsteiner @joaocunha @dcwarwick @gregbrown1229 whirlwind of stuff yesterday, try 2.1.3 please
@dcwarwick I don’t think the issue is isolated to (or perhaps even related to–I’m not sure)
cleancss()
, since I ran into this issue never having used it. In fact, I only installed it to test my solution for @joaocunha’s problem. I just happened upon this issue after googling for the error message I was encountering. It seems like it has to do with the combination ofincludePaths
in thegulp-sass
call andgulp-sourcemaps
, but I only dug far enough to find a workaround, since I found thatgulp-sourcemaps
already has a solution in their upcoming release.OK, this might help: it seems that it is any time a sass import has one or more
../
at the start of the path. Those../
seem to be getting lost. Example:If I put a file
_foo.scss
, and then make a subdirectorysub
in which I put a filebar.scss
, and inbar.scss
I haveand in my gulp build I pipe
sub/bar.scss
tosourcemaps()
, then tosass()
, then tocleancss()
, it will give this error:Notice that the path here,
/foo.scss
, seem to have lost the../
from the start.I hope this helps.
@scniro my case follows @arechsteiner’s.
See the comments below:
Error: