Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sass partial importing

Tags:

css

sass

I have an issue with sass compilation.

When I have a project with a partial _partial.scss and have it imported in multiple partial files (because it contains color variables) it will end up in the compiled css multiple times!

This is ugly because the same rule will 'overrule' itself multiple times which makes debugging info (chromium dev tools / firebug) rather unreadable.

I presume there is a solution for all this. I just can't find anything on the issue, anywhere.

like image 342
A.J.Rouvoet Avatar asked Dec 03 '25 17:12

A.J.Rouvoet


1 Answers

The solution is to either not include the same file multiple times or don't have any code that directly outputs CSS in the file you're planning on including more than once. If your variables were in a file by themselves, they could be safely included anywhere you'd like without selector duplication.

like image 114
cimmanon Avatar answered Dec 06 '25 12:12

cimmanon



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!