Do CSS preprocessors produce more efficient CSS?

By effective, I mean less code (less css rules).

Because I am converting a CSS file to a smaller one, and I was surprised to find that the compiled CSS file is quite small (I have not finished yet: P)

+5
source share
4 answers

LESS (when compiled) and Sass also reduce your CSS. In addition to removing spaces, you will sometimes see that things like border: 0 10px 0 10px, turn into border: 0 10pxor colors like #666666, turned into #666. It is not more efficient, but it does less load for the user (which is valuable for mobile devices).

, Sass , @extend, , , .

.classA { color: blue }

// 50 lines of code defining other elements...

.classB { @extend .classA }

- :

.classA, .classB { color: blue }

, 2 , - , .

. .

+2

, LESS. , (, ) @ .

, "" . CSS.

+3

, , CSS . , "" CSS ( , ) - , .., .

, , , , , WinLESS ( ) .

+2

, , LESS SASS, CSS, ( ), DOM, . , , DOM - . CSS, , , .

, , , . , , , "" , , , , . , CPU, . , , , , " - " - Knuth

+2

All Articles