Getting Started

Less is a CSS pre-processor, meaning that it extends the CSS language, adding features that allow variables, mixins, functions and many other techniques that allow you to make CSS that is more maintainable, themable and extendable.

Less runs inside Node, in the browser and inside Rhino. There are also many 3rd party tools that allow you to compile your files and watch for changes.

This will compile styles.less file and save the result to styles.css file. The output file parameter is optional. If it is missing, less will output the result to stdout.

Client-side usage

Using less.js in the browser is great for development, but it's not recommended for production

Client-side is the easiest way to get started and good for developing with Less, but in production, when performance and reliability is important, we recommend pre-compiling using node.js or one of the many third party tools available.

To start off, link your .less stylesheets with the rel attribute set to "stylesheet/less":

<linkrel="stylesheet/less"type="text/css"href="styles.less" />

Next, download less.js and include it in a <script></script> tag in the <head> element of your page:

<scriptsrc="less.js"type="text/javascript"></script>

Tips

Make sure you include your stylesheets before the script.

When you link more than one .less stylesheet each of them is compiled independently. So any variables, mixins or namespaces you define in a stylesheet are not accessible in any other.

Browser Options

Options are defined by setting them on a global less object before the <script src="less.js"></script>:

License FAQs

Less.js is released under the Apache 2 License (though there are plans to dual license it). Copyright 2009-2015, Alexis Sellier and the Less Core Team (see about). Boiled down to smaller chunks, it can be described with the following conditions.

It allows you to:

Freely download and use Less.js, in whole or in part, for personal, company internal or commercial purposes

Use Less.js in packages or distributions that you create

It forbids you to:

Redistribute any piece of Less.js without proper attribution

It requires you to:

Include a copy of the license in any redistribution you may make that includes Less.js

Provide clear attribution to The Less Core Team for any distributions that include Less.js

It does not require you to:

Include the source of Less.js itself, or of any modifications you may have made to it, in any redistribution you may assemble that includes it

Submit changes that you make to Less.js back to the Less.js project (though such feedback is encouraged)