Skip to content

Commit 304c310

Browse files
authored
fix(issue:4258) variable interpolation after math (#4292)
* fix(issue:4258) variable interpolation after math * Fixes variable interpolation issue after previous variable addition. * chore: fix rebase issue * Fix rebase issue for fix for issue #4258.
1 parent 509a007 commit 304c310

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

packages/less/src/less/parser/parser.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,9 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
17311731
}
17321732
// Treat like quoted values, but replace vars like unquoted expressions
17331733
const quote = new tree.Quoted('\'', item, true, index, fileInfo);
1734-
quote.variableRegex = /@([\w-]+)/g;
1734+
if (!item.startsWith('@{')) {
1735+
quote.variableRegex = /@([\w-]+)/g;
1736+
}
17351737
quote.propRegex = /\$([\w-]+)/g;
17361738
result.push(quote);
17371739
}

packages/test-data/css/_main/variables.css

+3
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,6 @@
7777
--tw-pinch-zoom: ;
7878
--tw-scroll-snap-strictness: proximity;
7979
}
80+
.radio_checked {
81+
border-color: #fff;
82+
}

packages/test-data/less/_main/variables.less

+11
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,14 @@
132132
--tw-pinch-zoom: ;
133133
--tw-scroll-snap-strictness: proximity;
134134
}
135+
136+
@a1: 1px;
137+
@b2: 2px;
138+
@c3: @a1 + @b2;
139+
140+
@radio-cls: radio;
141+
@radio-cls-checked: @{radio-cls}_checked;
142+
143+
.@{radio-cls-checked} {
144+
border-color: #fff;
145+
}

0 commit comments

Comments
 (0)