By applying LESS, you can mix in declarations like this:
/* LESS */
.foo {
/* some style here */
}
.bar {
.foo;
}
Note here if you want to hide ruleset .foo (probably a ruleset only for inheritance use) from the CSS output, you can modify the code above a little:
/* LESS */
.foo() { /* It's called "parametric mixin" */
/* some style here */
}
.bar {
.foo;
}
By using LESS (or SASS/Stylus if you like) you can decouple styles and class names in your HTML code while keeping style rulesets reusable:
<!-- no need to use style-related class name here -->
<h2 class="post-title">...</h2>
/* LESS */
/* reusable style ruleset */
.bold-title() {
font-weight: bold;
font-family: Impact, sans-serif;
}
/* actually use those rulesets */
.post-title {
.bold-title;
}
And after compilation you will get neat CSS code like this:
/* CSS */
.post-title {
font-weight: bold;
font-family: Impact, sans-serif;
}