Namespacing in Less

There is one thing I am sure you will find asking yourself as time goes by and your CSS style sheets get larger: can I group similar styles to make things easier to find?

Sure, you can always cut and paste similar styles together, but this is a manual process, right? What happens if two weeks down the line, you need to add a new style, which is similar to the one buried 1500-odd lines down? Surely there has to be a better way to do this—there is. Welcome to namespacing in Less!

Namespacing in Less takes your need to group similar styles and flips it on its head; it groups all of the constituent building blocks of your styles together, then allows you to pick and choose which styles to use when adding styling for a new element ...

Get Learning Less.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.