-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Source maps generation #1777
base: master
Are you sure you want to change the base?
Source maps generation #1777
Conversation
…ss-setting Markdown: Add global CSS setting.
This PR can't be merged. Can you rebase and try again? |
@madskristensen done. |
var map = result.map.toString(); | ||
var map, css = result.css.toString(); | ||
if (!options.omitSourceMapUrl) | ||
map = result.map.toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note:
omitSourceMapUrl
option in node-sass does not indicate the presence of source-map, but only the URL.- In Web Essentials, we need source-maps in all cases for editor enhancements.
I didn't think of autoprefixer use case before, where it would not be able to update the map file accordingly (since sourceMappingURL
acts as a bridge). For that matter, we would need to inject the sourceMappingURL
here to CSS:
var css = result.css.toString();
var map = result.map.toString();
var appendix;
if (!options.omitSourceMapUrl) {
appendix = '\n/*# sourceMappingURL= ' + params.mapFileName + ' */';
css += appendix;
}
Then later on:
- css = autoprefixedOutput.css;
+ css = autoprefixedOutput.css.replace(appendix, '');
- RtlContent: rtlResult.css,
+ RtlContent: rtlResult.css.replace(appendix, ''),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@am11 This has nothing to do with autoprefixer being able to update the existing map. I used the flag because it indicates if source map generation is requested or not ( omitSourceMapUrl
equals params.sourceMapURL === undefined
).
If source maps generation is always enabled, then why its conditional in both autoprefixer and rtlcss ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it indicates if source map generation is requested or not
Wrong. Please re-read my previous comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm referring to input/output params, not node-sass!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
???
I totally lost you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be more clear if I had wrote it like this :
var map, css = result.css.toString();
if (params.sourceMapURL !== undefined)
map = result.map.toString();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I said earlier, the compiler services (which support sourcemap, exception being LiveScript), should return source map to Web Essentials in all cases. WE then uses source-maps for editor extensibility features.
If sourcemap in autoprefixer is conditional, then that is a (separate) bug.
If sourcemap in RTLCss is conditional, then that is by design (because rtlcss result are returned separately).
Therefore, the real issue here is that the post-processed source-maps should overwrite those generated by node-based compiler, but it should respect the user-intended params.sourceMapURL
option. And hence, the solution I described above would fix it. If you are still unconvinced, you can checkout the changes in srv-scss, as this is slightly out of scope for this PR. I will take care of it once the WE solution starts building again.
I have left a comment. Other than that bit, @MohammadYounes has better understanding of postcss. 😄 |
Make sure generated source maps are not inline.
Respect
Scss
.GenerateSourceMaps
flag.Respect
Css
.GenerateRtlSourceMaps
flag.To ensure services compatibility in the future, May be the build task should fix the major version of the downloaded node packages.
Related: #1726
Thanks.