-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sourcemap doesn't include @import'ed files #83
Comments
Upon some further investigation - v-colors.css does show in the sourcemap so long as there is more than just variable assignments: v-colors.css : $v-colors_primary : blue;
body { color: black; } produces sourcemap :
This kind of fixes Issue 1 noted above - however this may also reveal why Issue 2 is failing - it seems as if variables are not being mapped in sourcemaps. Which prevents chrome dev tools from doing this awesomeness: https://youtu.be/x6qe_kVaBpg?t=8m11s |
Noticing your tests for sourcemap - if you change the file imported.css to just : $color : blue; And even use that variable in in.css : @import "imported.css";
body {
color: $color;
} You'll see the sourcemap then drops the path to imported.css file all together. It only works if there is something besides variable assignments ( maybe this is a postcss-simple-vars issue? or grunt-postcss? ) |
postcss-import merge multiples files as a single AST. |
Do you think there might be a way to enable this kind of sourcemapping: https://youtu.be/x6qe_kVaBpg?t=8m11s ? It would be super helpful to jump to where a variable is defined as he does in the video. I'll take a look at postcss-simple-vars. Thanks for the input! |
I know that PostCSS does declaration source mapping, but I'm not sure it does values. See Also, how would you handle that in cases where you have multiple variables being called in a declaration value? Like: a {
border: $width $style $color;
} I'd love to get this working with |
Like I said before, from what I know or postcss, a node can only have one origin. And it will be the origin of the declaration, not the values. |
Yep. That confirms what I was thinking. |
( Of course, unless I'm doing something incorrectly )
Settings and files to reproduce:
Gruntfile.js :
lib/css/init.css :
lib/css/variables/v-colors.css :
The resulting sourcemap makes no mention of the file path to v-colors.css in "sources" array
Issue 1: This prevents chrome dev tools from auto-refreshing the styles on a page if a developer edits the imported file.
Issue 2: This also prevents chrome dev tools' inspector from linking the css value of a property to the correct file so long as that file is one that was imported. ( links incorrectly to init.css, should link to v-colors.css as that's where the variable was assigned )
The text was updated successfully, but these errors were encountered: