I have just started using SCSS for the first time. I'm noticing that the resulting CSS is somewhat less optimised than it would be if I had written it by hand. For example, I am using mixins for style duplication, like this:
@mixin button {
border-radius: 4px 20px 20px 4px;
-moz-border-radius: 4px 20px 20px 4px;
}
.enquire {
.live-chat {
@include button;
background: #21a649;
}
.enquire-now {
@include button;
background: #33b1ff;
}
}
Then all I need on the button is the single class, "enquire-now", and all the styles are included in that one class in the CSS.
If I had written this by hand, however, I would have used 2 classes, like this:
.button {
border-radius: 4px 20px 20px 4px;
-moz-border-radius: 4px 20px 20px 4px;
}
.enquire .live-chat {
background: #21a649;
}
.enquire .enquire-now {
background: #33b1ff;
}
And then on the element, used "button enquire-now"
So by using the mixin, I am minimising the classes used in my HTML and making it pleasant to write, but am making my actual CSS file much longer! This seems somewhat counterproductive... Have I missed something?
What's the point of mixins, if doing the old fashioned way actually produces a smaller CSS file?