absurd icon indicating copy to clipboard operation
absurd copied to clipboard

Generate source map for CSS preprocessing

Open krasimir opened this issue 10 years ago • 9 comments

Source map is needed so the developers could find the exact styles in a specific js file.

krasimir avatar Dec 17 '13 08:12 krasimir

I'm interested in this and may try to drum something up to resolve the source map issue. @krasimir do you have any ideas on where to start?

stockholmux avatar Aug 07 '14 13:08 stockholmux

Hi, this one is staying in my Inbox but I didn't have time to start working on it. I'm glad that someone is interested. Here are two links that I have bookmarked related to this issue:

https://developer.chrome.com/devtools/docs/css-preprocessors http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/

krasimir avatar Aug 07 '14 13:08 krasimir

I was literally just looking at those two links.

Seems like exposing line numbers in Node is a bit complicated - I've played around with the stacktrace method before. But I have fears that it will be terribly slow and memory heavy based on the number of rules that the average stylesheet has.

The other thought I had was an optional source map rule - if Absurd finds it, it adds it to the sourcemap based whatever you pass to it. It would help in debugging tricky issues, but wouldn't clog the entire parsing step.

Thoughts?

stockholmux avatar Aug 07 '14 14:08 stockholmux

It is indeed complicated. That's why I didn't start doing it I guess :) I thought about playing with http://esprima.org/ However, in our case if the developer use shortcuts for the properties this may be really really complex task.

krasimir avatar Aug 07 '14 14:08 krasimir

I wasn't familiar with esprima, I may keep that in my back pocket. Talk about re-inventing the wheel though!

stockholmux avatar Aug 07 '14 15:08 stockholmux

It's always fun to reinvent the wheel. I'll be really interested to see how it goes.

krasimir avatar Aug 07 '14 21:08 krasimir

Has there been any work on this? It would be great to see the style line numbers in chrome inspector when making my styles. I feel like this is one of the few things stopping me from using this framework rather than just scss.

autoferrit avatar Apr 20 '16 16:04 autoferrit

Hello @SkiftCreative,

the generation of source maps is easily achievable if we have AST representation of the code. However, Absurd is not transpiling and it is not dealing with AST transformations. It uses a custom JavaScript logic for generating the CSS which makes the source maps implementation difficult. This issue is opened for years without any actions on it but I'll try addressing this feature in the next months.

krasimir avatar Apr 21 '16 04:04 krasimir

That would be awesome. I don't know enough about that part to help. I think having that could really help with adoption as well. Since it will make dev easier.

thanks.

autoferrit avatar Apr 22 '16 16:04 autoferrit