leafo / scssphp

SCSS compiler written in PHP
MIT License
1.34k stars 214 forks source link

Always have (stdin) in source map #677

Closed AdamPerkins closed 4 years ago

AdamPerkins commented 5 years ago

I'm using master branch.

Whatever I do I have this kind of source map (here's a minimal example): {"version":3,"file":"cms.css","sourceRoot":"/","sources":["(stdin)"],"names":[],"mappings":"AAAA"}

Instead of the name of "cms.scss" (in my case) there is "(stdin)"

This is the simple cms.css: h1 { color: blue; } /*# sourceMappingURL=cms.css.map */

The compiler works fine even in complex situations with importing Bootstrap framework. The generated css is well.

Having a short look into the code I have seen that the word (stdin) comes from the constructor of the parser class which is called by the compile function.

Don't know what I have to change or if it's a bug.

robocoder commented 5 years ago

What source map options are you using?

Reference: https://github.com/leafo/scssphp/wiki/Source-Maps

Der-Alex commented 5 years ago

Hi. I have the same issue with creating source maps. tried the SOURE_MAP_INLINE and the SOURCE_MAP_FILE option.

airelibre commented 5 years ago

Same here with options:

But if I call $preprocessor->compile($scss, '/'); (with the second param), no more error - I just then get two times the base "path" in the sourcemap.map file: {"version":3,"sourceRoot":"/","sources":["subdir/www/","subdir/www/","subdir/www/assets/themes/MyTheme/scss/foundation/vendor/normalize.scss" ...