Skip to content

Commit

Permalink
v1.7.2: math supported in line
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcrowl committed Jan 30, 2021
1 parent ea66142 commit 9092feb
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,30 @@ N.B. Also available from the command palette as "Compile LESS to CSS".
- Enables inline javascript within less files (defaults to `false`).
- Inline JavaScript occurs for any text within backticks, e.g. `` font-weight: `10+10`px'; ``

`math: { "parens-division" | "parens" | "always" | "strict" | "strict-legacy" }`

- Controls the `math` option [used by the less compiler](http://lesscss.org/usage/#less-options-math).
- The default changed to `"parens-division"` in [less v4.0.0](https://github.com/less/less.js/releases/tag/v4.0.0) (and consequently in Easy LESS v1.7.0)
- The default for Easy LESS matches upstream, which is `"parens-division"`.
- To restore the less v3.x behaviour, use:
```json
{
"less.compile": {
"math": "always"
}
}
```
... or, using a per-file directive:
```less
// math: always
```
Alternatively, you can wrap your expression in parentheses:
```less
.w-third {
width: (100% / 3);
}
```

## Settings Cascade Order

Settings are read and applied in the following order:
Expand Down
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "easy-less",
"displayName": "Easy LESS",
"description": "Auto-compile LESS to CSS on save",
"version": "1.7.1",
"version": "1.7.2",
"publisher": "mrcrowl",
"engines": {
"vscode": "^1.31.0"
Expand Down Expand Up @@ -95,6 +95,18 @@
],
"description": "The 'browsers' argument for autoprefixer plugin (see https://github.com/ai/browserslist#queries)",
"default": "> 5%, last 2 Chrome versions, not ie 6-9"
},
"math": {
"type": "string",
"description": "The `math` mode used by less. Default is `parens-division` (see http://lesscss.org/usage/#less-options-math)",
"oneOf": [
"parens-division",
"parens",
"always",
"strict",
"strict-legacy"
],
"default": "parens-division"
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/FileOptionsParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const SUPPORTED_PER_FILE_OPTS = {
ieCompat: true,
autoprefixer: true,
javascriptEnabled: true,
math: true,
};

const ARRAY_OPTS: { [key: string]: any } = {
Expand Down

0 comments on commit 9092feb

Please sign in to comment.