Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Less/Sass debugging in Chrome Dev Tools/Firebug [closed]

How do you guys do maintenance on CSS built with Less/Sass?

One of the things I like about Dev Tools/Firebug is the ability to see the line number of a css styling. Is there a good way to do this with CSS preprocessors other than having to manually search through the .less/.scss file to find the code I want to modify?

like image 909
Dave Stibrany Avatar asked Mar 26 '12 00:03

Dave Stibrany


People also ask

What is Chrome Dev?

Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser. These tools let you inspect the rendered HTML (DOM) and network activity of your pages. You can use DevTools to troubleshoot ad serving issues.


1 Answers

Chrome Developer Tools now supports Sass debugging out-of-the-box.

Updated to include source maps:
Previous versions used inline comment in your css to provide a refernce to the source code (see below how-to). recent versions of sass (3.3+) and chrome (31+) use source maps for that:

  1. Make sure you have Sass 3.3.x
  2. Compile your Sass with the --sourcemap flag.
  3. In Chrome/ium DevTools open settings and click general.
  4. Turn on "Enable CSS source maps".

More info is available on the Chrome dev tools blog: https://developers.google.com/chrome-developer-tools/docs/css-preprocessors

Older versions:
1. First, you should compile your Sass with --debug-info turned on.
2. In Chrome/ium go to about:flags
3. Enable Developer Tools experiments
4. In your inspector (F12), open "Settings", then go to the "Experiments" tab and check "Support for SASS".

like image 65
tsi Avatar answered Sep 22 '22 07:09

tsi