-
Notifications
You must be signed in to change notification settings - Fork 59
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 map not created #7
Comments
A quick scan through, it looks like Something like:
If that looks like a good approach, I'll have a go at a PR. |
Yea that looks great! |
I notice that A question for @cferdinandi would be, would you like the default behavior to include source maps or not? I generally agree with Chris Coyier's take on this topic, in that they don't impact performance or the end-user experience. As a boilerplate/project scaffold, to me it makes sense for quickly spooling up a new project if they were on by default - IMHO. |
Awesomesauce! FWIW I find sourcemaps to be invaluable tools for development and I generally deploy them to production sites, too... |
I'd personally prefer they not be the default, with an option to enable them. |
@foxacid @cferdinandi let me know if #12 behaves as expected. |
@bnjmnrsh Thanks a lot! It works flawlessly with expanded CSS files but seems broken for minified CSS, unfortunately... |
The minified CSS strips out all comments, which is likely where the issue stems from. |
Hmmm, the |
But the in-code comments it uses are stripped out, no? |
@foxacid Taking the project as is, if I adjust the stylesheet link to
In this case, the sourcemap link is generated by So currently I suspect two possible culprits:
On that second point, I have seen a few instances where rather than fully replacing all the content of the file output, only half the data was written. I tossed it up as a fluke at the time. I swear I have a point that Im trundling toward here! But if you wouldn't mind, double-check that your SCSS validates, and make sure when you run the build again, but that you first delete everything in If you're still getting errors after those checks, could you provide a reduced test case of SCSS that I can use to see what's going on? |
@bnjmnrsh Thank you for bearing with me. Indeed the generated CSS and sourcemap URL look correct. I usually develop on Firefox but while writing this I quickly checked on Chrome and - lo and behold - the minified sourcemap works just fine! Here are the Firefox screenshots I prepared a few minutes earlier using the |
Just to double-check, I just discovered (as I don't always use FF for debugging) that sourcemaps are not enabled by default in FF dev tools (yes, even in FF Developer Edition!). Can you check they are enabled for you? These photos are for Mac FF Developer Edition. PC may be slightly different. |
Hold the press . . . the URL in your snapshots shows you're loading the file directly, not using the development server, it should be Please also make sure to |
I had the source maps option enabled. FWIW I'm running FF 87.0 on macOS 10.14.6. I'm currently downloading the Developer Edition to see if that works... |
Same behaviour on Firefox Developer Edition 88.0b5. Sourcemaps for expanded CSS work like a charm, not so the minified version. Can you confirm that loading the minified |
In any case this seems like a Firefox bug as it works flawlessly in Chromium based Browsers. So I guess the issue is good to be closed...? |
@foxacid, I've tested minified sourcempas on FF Dev Edition 88.05b, and FF 86.0 and I'm not able to reproduce this issue - all references to A real head-scratcher, perhaps some sort of caching or permissions issue? For comparison, for stand-alone source maps, here is what Im getting:
Lastly, have you tested setting the configs: |
I found something! Firefox will show the original SASS file in the Style Editor tab (provided the 'Show original sources' option is enabled), but not in the Inspector tab. This is strange because it does show the original source in the Inspector tab when using expanded CSS... min-sourcemaps.mov |
Ahh, Im glad we got it figured out. I'll update the version of the readme in this PR to highlight this for FF users. I've run into a separate issue that affects portability and will add comments, and push an update shortly. |
In ref to 539006f: I've realised that the JavaScript implimtation of This means that the source maps this PR had generated were bound to the environment in which they were built (ie local vs production), resulting in source maps that look like this:
It's unreasonable to force Devs to build in production for source maps to work there, and in many cases, the The Dart Sass CLI exposes a
Going this route wouldn't affect the end-user, as they wouldn't load maps (unless they open Devtools), but it will make it much easier to debug CSS in a production where the absolute paths generated locally are sure to be broken. To prevent people accidentally pushing to production inflated CSS with both the source map and the source SASS embeded, I've removed the |
Good work @bnjmnrsh! Seems like you went down the sourcemaps rabbithole ;) |
@foxacid rabbit-hole indeed! We've spent a lot of time looking at the Sass side of things, and on the JS side Rollup seems to be handling source maps without issue –– Chrome/FF/Safari are pointing to non-minified versions of files as expected. @cferdinandi, based on these tests I believe this PR, feature-wise, is in a complete state. Is there anything you would like to see changed? |
Hey, thanks for this nice setup!
Setting
sourceMap: true
insass.js
adds a sourceMappingURL to the CSS files but does not actually compile a source map. Any ideas?The text was updated successfully, but these errors were encountered: