Skip to content

Commit

Permalink
fix(issue:3737) allow blank variable declarations
Browse files Browse the repository at this point in the history
* Fixes issue with blank CSS variable declarations.
  • Loading branch information
puckowski committed Dec 8, 2024
1 parent e4fdbe3 commit b6656b0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/less/src/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions packages/test-data/css/_main/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
7 changes: 7 additions & 0 deletions packages/test-data/less/_main/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit b6656b0

Please sign in to comment.