Purpose - styling webpage
Problems
- Duplication
- Verbosity
- Lack of semantic value
- Handling other used assets
>>> Variable <<<
Sass | Less
----------------------------------+-----------------
$color: red; | @color: red;
#menu a { | #menu a {
color: $color; | color: @color;
} | }
>>> Mixins <<<
Sass | Less
----------------------------------+----------------------------------
@mixin borderadius($radius) { | .borderadius(@radius) {
border: solid 2px black; | border: solid 2px black;
border-radius: $radius; | border-radius: @radius;
} | }
|
#menu a { | #menu a {
@include borderadius(3px); | .borderadius(3px);
} | }
>>> Extending <<<
Sass | Less
----------------------------------+----------------------------------
.bordered { | .bordered {
border: 1px solid red; | border: 1px solid red;
} | }
|
#menu a { | #menu a {
@extend .bordered; | &:extend(.bordered);
border-bottom: 2px; | border-bottom: 2px;
} | }
Need sprites - go with Sass (Compass (ruby
) handles them for you)
Don't use PHP implementations - they are bad!
- JUST refresh browser*
- Start watcher - program that tracks changes in files and recompiles assets
- Edit stylesheet
- Refresh browser
Reduces CSS file size to improve loading time at price of readability