Allow creating a source map
see https://github.com/nex3/sass/pull/569
and #1038
We should output source maps in the new format
+1
:+1:
+1
+2
+1
+1, obviously!
+1
+1
if anyone wants to work on this
https://github.com/cloudhead/less.js/tree/import-interpolation
now has a visitor pattern implemented.
you should be able to use this to go over the nodes and grab original input information.
What you don't know is the target (css) line number.
To do that I would suggest having functions on the toCSS env object which build up the css and keep track of the current line number. You can then store that line number against the node.
After that it should be simple.
i'm not good at compiler theory (in fact i am at this course at college now) and haven't looked up less' code, but can't just write to a variable say, lineNumber and at each line break increment it? it should keep the line number state, after that it could be exposed to the function mapping the lines.
@madcampos
yes.. that is this bit of the implementation I described.
having functions on the toCSS env object which build up the css and keep track of the current line number.
you need to keep track of the line number on the env object but also store its current value against each node as you output the css, then the ast has the source and the target line numbers and a mapping can be made.
+1
lol, we're all for it, looks like we just need an adept JavaScript / LESS programmer to fix it up and do a pull request. ;-)
+1 very important feature
You may want to use the SourceMapGenerator here: https://github.com/mozilla/source-map
I wrote a simple less middleware https://gist.github.com/undoZen/5806774
That looks awesome!
Aria Stewart
On June 18, 2013 at 12:13:41 PM, 安动生 ([email protected]) wrote: I wrote a simple less middleware https://gist.github.com/undoZen/5806774 — Reply to this email directly or view it on GitHub.
Thanks for the middleware, i will try this at home. Any way it gets to be merged into less core? Or some solution like this? Em 18/06/2013 12:25, "Aria Stewart" [email protected] escreveu:
That looks awesome!
Aria Stewart
On June 18, 2013 at 12:13:41 PM, 安动生 ([email protected]) wrote: I wrote a simple less middleware https://gist.github.com/undoZen/5806774 — Reply to this email directly or view it on GitHub.
— Reply to this email directly or view it on GitHubhttps://github.com/cloudhead/less.js/issues/1050#issuecomment-19622929 .
+1... +2... +100... This is an incredibly important feature.
+1