WebEssentials LESS CSS map files not working
I have a problem with my less map files generated by Visual Studio Web Essentials when working with local less code using WAMP server for web development. Whenever I save changes to less file the corresponding css, css.map and min.css files are generated as expected but the Chrome and Firefox dev tools don't recognize them. They don't map to the less source files as expected always showing only the "style.css:123"
line number instead of "source.less:45"
. Does anybody has the some issues? I tried the following things: - ensured that the chrome settings: "Enable CSS source maps & Auto-reload generated CSS": both are checked. - added the folders to chrome workspace - tried different settings in the WebEssential LESS options. - ensured that the generated style.css ends with the line: /*# sourceMappingURL=style.css.map */
What am I missing here? Any clues? I'm pretty sure that mapping directly to less source files was working a few time ago because this was one of the key features I choosed using less?!
I had the same problem and I resolved it only after 4 hours of trials and frustration...
The files generated by Web Essentials (2013 2.6) are encoded in "UTF-8 with BOM" while the source maps file should be "UTF-8 without BOM" to work ("ANSI" works too). I guess that the little sequence of bytes added causes a misinterpretation of source maps file or makes it not a valid JSON to Chrome/FF parser (but again this is just a guess).
If you change the encoding of source maps file to UTF-8 without BOM then Dev tools should work as expected.
Unfortunately it seems that Web Essentials doesn't allow to choose the file encoding and it is not related to the encoding of the starting file (so if you compile a less file encoded in "UTF-8 without BOM" or "ANSI" it still generate UTF-8 encoded files).
We are currently investigating work-arounds, otherwise we will drop web essentials and go for other tools.
Let me know if this was useful (I know it's late but still...).
链接地址: http://www.djcxy.com/p/66994.html