11

It looks as though LESS debugging has come a decent distance since even a year ago, and I was wondering how many people have experience with debugging using developer tools in Chrome/Canary.

I'm trying to ensure that when I'm debugging a file, the element's CSS shows up as the LESS file, rather than the CSS file. It's of little use to have CSS line numbers show up, when I need to know the requisite line number of the LESS file. I can do this in firefox with firebug and fireless, but it's not working in chrome

I tried to follow the steps here, however it doesn't appear to be functioning for me correctly even after following the instructions carefully.

I'm running OSX, have LESS installed via node.js, and am using the ST2 plugin Less2CSS in order to process the less file on save. Using the command lessc --line-numbers=mediaquery style.less style.css works as expected and writes this to the top of my css file @media -sass-debug-info{filename{font-family:file\:\/\/\/Applications\/XAMPP\/xamppfiles\/htdocs\/sandbox\/lessDebug\/style\.less}line{font-family:\000035}}, however when inspecting an element, it's still only catching the CSS file, and not the LESS file.

I have the requisite Chrome preferences turned on (Support for SASS and Enable Source Maps)

Thoughts?

Duncan
  • 125
  • 1
  • 5

3 Answers3

4

This is now working perfectly fine with less.js 1.5b4 and Chrome 30.0.1599.69

Basically, you need to make sure lessc generates valid source map url at the end of your css file:

/*# sourceMappingURL=/templates/lwks/css/template.css.map */

and that the .css.map file is being loaded by the browser. If this is still for some reason not working for you, in check chrome://flags Enable Developer Tools experiments is on

enter image description here

more details here: https://github.com/less/less.js/issues/1050

WooDzu
  • 4,631
  • 6
  • 28
  • 58
3

Blog post author here...I've gone back and updated my post so it now works with regular Chrome 26. Just checked in Canary and it doesn't seem to work anymore. So Chrome 24 - 26 are good but Canary is busted.

robdodson
  • 6,264
  • 5
  • 25
  • 34
0

I think that the issues that you refer are not related.

As far as I understand you compile your LESS file on the server side and all you want to do is to retrieve the new css file and not the cached one? Am I right?

Did you tried disable cache on google chrome?

Community
  • 1
  • 1
Rui Carneiro
  • 5,299
  • 4
  • 31
  • 38
  • Sorry if I wasn't clear: I'm trying to ensure that when I'm debugging a file, the element's CSS shows up as the LESS file, rather than the CSS file. It's of little use to have CSS line numbers show up, when I need to know the requisite line number of the LESS file. I can do this in firefox with firebug and fireless, but it's not working in chrome – Duncan Mar 27 '13 at 17:56
  • This comment is way more clear than your original post. Please consider editing the OP :) – Rui Carneiro Mar 27 '13 at 17:57