
Less.js
The dynamic stylesheet language. lesscss.org
[!IMPORTANT]
This package README is for Less 5 alpha.1. Less 5 is a Jess-powered compiler
preview for early testing and is not yet a drop-in replacement for Less 4.x.
It covers Node.js less.render(), less.renderFile(), and lessc, plus
variables, arithmetic, mixins, imports, and nested-rule output. Source maps,
URL rewriting, and compress now work through the less.render() API; the
legacy @plugin hook ABI is intentionally not carried over (function plugins
are supported). See the Less 5 feature status for the full
list of what is implemented, in progress, and intentionally not.
Less extends CSS with variables, mixins, functions, nesting, and more — then compiles to standard CSS. Write cleaner stylesheets with less code.
@primary: #4a90d9;
.button {
color: @primary;
&:hover {
color: darken(@primary, 10%);
}
}
Install
npm install less@alpha
For a pinned first alpha:
npm install less@5.0.0-alpha.1
Usage
Node.js
Less 5 alpha.1 requires Node.js ^20.19.0 || >=22.12.0.
import less from 'less';
const output = await less.render('.class { width: (1 + 1) }');
console.log(output.css);
Command Line
npx lessc styles.less styles.css
Browser
A browser build ships in the package (dist/less-browser-dev.js) and defines
window.less with the same render API; it powers the online playground. Full
browser-API parity with Less 4 is still being validated — see the
feature status.
Why Less?
- Variables — define reusable values once
- Mixins — reuse groups of declarations across rulesets
- Nesting — mirror HTML structure in your stylesheets
- Functions — transform colors, manipulate strings, do math
- Imports — split stylesheets into manageable pieces
- Extend — reduce output size by combining selectors
Documentation
Full documentation, usage guides, and configuration options at lesscss.org.
Contributing
Less.js is open source. Report bugs, submit pull requests, or help improve the documentation.
See CONTRIBUTING.md for development setup.
License
Copyright (c) 2009-2025 Alexis Sellier & The Core Less Team
Licensed under the Apache License.