From 509a007c40e7606bd5321456f1069a99ecb9f052 Mon Sep 17 00:00:00 2001 From: Daniel Puckowski Date: Sun, 8 Dec 2024 07:32:45 -0500 Subject: [PATCH] fix(issue:3737) allow blank variable declarations (#4294) * Fixes issue with blank CSS variable declarations. --- packages/less/src/less/parser/parser.js | 6 +++++- packages/test-data/css/_main/variables.css | 8 ++++++++ packages/test-data/less/_main/variables.less | 7 +++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/packages/less/src/less/parser/parser.js b/packages/less/src/less/parser/parser.js index 532124e89..139e954af 100644 --- a/packages/less/src/less/parser/parser.js +++ b/packages/less/src/less/parser/parser.js @@ -1598,7 +1598,11 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) { // Custom property values get permissive parsing if (name[0].value && name[0].value.slice(0, 2) === '--') { - value = this.permissiveValue(/[;}]/); + if (parserInput.$char(';')) { + value = new Anonymous(''); + } else { + value = this.permissiveValue(/[;}]/); + } } // Try to store values as anonymous // If we need the value later we'll re-parse it in ruleset.parseValue diff --git a/packages/test-data/css/_main/variables.css b/packages/test-data/css/_main/variables.css index fa03b1eb7..ffa374106 100644 --- a/packages/test-data/css/_main/variables.css +++ b/packages/test-data/css/_main/variables.css @@ -69,3 +69,11 @@ mul-px-2: 140px; mul-px-3: 140px; } +*, +::before, +::after { + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; +} diff --git a/packages/test-data/less/_main/variables.less b/packages/test-data/less/_main/variables.less index ae8c9be45..4f3a7a324 100644 --- a/packages/test-data/less/_main/variables.less +++ b/packages/test-data/less/_main/variables.less @@ -125,3 +125,10 @@ mul-px-3: ((@px * 1) * @cm); } } + +*, ::before, ::after { + --tw-pan-x: ; + --tw-pan-y: ; + --tw-pinch-zoom: ; + --tw-scroll-snap-strictness: proximity; +}