From 70d0936b60b4a885c0f6058f51e77aecf8bd5f93 Mon Sep 17 00:00:00 2001 From: Daniel Puckowski Date: Sat, 14 Dec 2024 16:38:44 -0500 Subject: [PATCH] fix(issue:3767) variable values with periods * Fix issue with variable values with periods when unquoted by single or double quotes. --- packages/less/src/less/parser/parser.js | 15 +++++++++++++++ packages/test-data/css/_main/variables.css | 9 +++++++++ packages/test-data/less/_main/variables.less | 18 ++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/packages/less/src/less/parser/parser.js b/packages/less/src/less/parser/parser.js index b87b4d762..1fa571568 100644 --- a/packages/less/src/less/parser/parser.js +++ b/packages/less/src/less/parser/parser.js @@ -1604,6 +1604,9 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) { value = this.permissiveValue(/[;}]/); } } + else if (isVariable) { + value = this.variableValue(); + } // Try to store values as anonymous // If we need the value later we'll re-parse it in ruleset.parseValue else { @@ -1638,6 +1641,18 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) { parserInput.restore(); } }, + variableValue: function () { + let match = this.anonymousValue(); + if (match) { + return match; + } else { + const index = parserInput.i; + match = parserInput.$re(/^([^#@$+/'"*`(;{}-]*);|(^[(?!.*\n)^.#@$+/'"*`(;{}-]*)(["'])((?!.*@.*)(?