From 9092feb3d98601e29968b76efd39a64c03609fcf Mon Sep 17 00:00:00 2001 From: Ben Crowl Date: Sun, 31 Jan 2021 07:49:00 +1300 Subject: [PATCH] v1.7.2: math supported in line --- README.md | 24 ++++++++++++++++++++++++ package.json | 14 +++++++++++++- src/FileOptionsParser.ts | 1 + 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 897d0a8..bba7f8c 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/package.json b/package.json index 00b26fb..1393dc9 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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" } } } diff --git a/src/FileOptionsParser.ts b/src/FileOptionsParser.ts index bd9a282..fc54d3a 100644 --- a/src/FileOptionsParser.ts +++ b/src/FileOptionsParser.ts @@ -11,6 +11,7 @@ const SUPPORTED_PER_FILE_OPTS = { ieCompat: true, autoprefixer: true, javascriptEnabled: true, + math: true, }; const ARRAY_OPTS: { [key: string]: any } = {