Open mahnunchik opened 10 years ago
Ya, I had considered this. I'll need to do some homework on how to create an "identity" sourcemap for a .css file, as well as how to do the concatenation. Any links for how sourcemaps for CSS work?
Difference from JS is in comment style: Source Map Revision 3 Proposal page 7
Working with CSS Preprocessors article from google
(sorry for the delay, email woes)
Well, that bit is easy, hadn't noticed it before, thx!
The important bit is "is the structure the same". I guess it must be. And I guess I can do the same cheat I do for .js files, by making an "identity" sourcemap that is a 1-1 mapping between the lines. I'm not happy with having to do that, as it's too big (comments get mapped) and too small (one line mapped for multiple statements on a line). Nice thing is I don't have to parse the JS. If the same strategy works for the CSS maps, then ... we got lucky.
The way I originally imagined this working is that we'd guess the type based on the file extensions in play. I guess we can just look at the output file's extension. So, if "css" do CSS source mapping; if anything else, do JS source mapping. Are there other extensions that folks would use for CSS?
Sorry for the delay.
I think that looking at the output file's extension is suitable for this case. Also, I think it makes sense to process only standard extensions ".js" and ".css".
It may be done by handling this type of comment: