Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does chrome style inspector show style from .scss?

When I use the 'styles' tab of the Google Chrome developer tools, it reports one of my styles as coming from the .scss file. How is this possible - I thought all .scss had to be flattened and read from a .css file:

enter image description here

like image 530
Chris Halcrow Avatar asked Apr 10 '17 05:04

Chris Halcrow


People also ask

Why is my CSS crossed out in Inspector?

If you can see your new CSS in the Styles pane, but your new CSS is crossed out, it means that there's some other CSS that is overriding your new CSS. In CSS terminology this concept is called Specificity. Chrome DevTools can help you find the old CSS that is causing your new CSS to not be applied.

Does browser understand SCSS?

In general, browsers do not know how to process SCSS features, such as functions, mixins, and nesting. We'll need to convert them to regular CSS files to run them in the browser.

Can Chrome use SCSS?

Now you can edit your SCSS in the browser and when you save, Chrome will write those changes to the actual file. If you are watching your Sass for changes, the SCSS will get compiled and the CSS will be auto refreshed in your page including your changes.


1 Answers

When you compile your sass into css, you have an option to generate a source map file. At the end of the css file you will find a reference to a map file which will be located in the same folder location as your css, with a .map extension.

This is used by chrome inspector to help development. You can turn it off in chrome inspector or just remove the reference to the source map from the css or remove the option to generate the source map in the first place.

If you just want chrome to show the css and are happy to keep the source map file you can just turn off the option. To turn off the option in Chrome Developer Tools, open up inspector and go to Settings. Look in the Sources category within the Preferences section, and untick "Enable css source maps"

like image 107
partypete25 Avatar answered Sep 26 '22 01:09

partypete25