Skip to content

Commit

Permalink
fix(issue:4264) strip line comment from expression
Browse files Browse the repository at this point in the history
* Fix for issue #4264. Strip line comments from expressions to avoid
  invalid CSS output.
  • Loading branch information
puckowski committed Dec 8, 2024
1 parent 509a007 commit 9f97c8e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/less/src/less/parser/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2416,7 +2416,7 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {

do {
e = this.comment();
if (e) {
if (e && !e.isLineComment) {
entities.push(e);
continue;
}
Expand Down
15 changes: 15 additions & 0 deletions packages/test-data/css/_main/variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,18 @@
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
}
div#apple {
color: blue;
}
div#banana {
color: blue;
}
div#cherry {
color: blue;
}
div#carrot {
color: blue;
}
div#potato {
color: blue;
}
16 changes: 16 additions & 0 deletions packages/test-data/less/_main/variables.less
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,19 @@
--tw-pinch-zoom: ;
--tw-scroll-snap-strictness: proximity;
}

@items:
// Fruit
apple,
banana,
cherry,
// Vegetables
carrot,
potato,
;

each(@items, {
div#@{value} {
color: blue;
}
})

0 comments on commit 9f97c8e

Please sign in to comment.