mirror of
https://github.com/less/less.js.git
synced 2026-05-02 03:00:16 -04:00
* Initial plan * Fix: not keyword now works without parentheses in guard conditions Previously, `boolean(not false)` silently ignored the `not` keyword while `boolean(not (false))` worked correctly. The `negatedCondition` parser function consumed the `not` keyword but only tried `parenthesisCondition`, which requires `(`. With no parens, it returned undefined with `not` already consumed, causing silent skip. Fix: fall back to `atomicCondition` when `parenthesisCondition` fails, allowing both `not false` and `not (false)` to work consistently. Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> * Restrict not-without-parens to simple values only (keywords/variables) Complex conditions like `not 2 < 1` still require parentheses, keeping alignment with CSS media query syntax. Only simple bare values (keywords, variables, quoted strings) are allowed after `not` without parens: `not false`, `not @var`. Remove the `boolean(not 2 < 1)` test case that relied on the broader atomicCondition fallback. Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: matthew-dean <414752+matthew-dean@users.noreply.github.com> Co-authored-by: Matthew Dean <matthew-dean@users.noreply.github.com>
Less.js
The dynamic stylesheet language. lesscss.org
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
Usage
Node.js
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
<link rel="stylesheet/less" type="text/css" href="styles.less" />
<script src="https://cdn.jsdelivr.net/npm/less"></script>
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.
