Skip to content

Commit a141d0a

Browse files
committed
fix(issue:4258) variable interpolation after math
* Fixes variable interpolation issue after previous variable addition.
1 parent 773e157 commit a141d0a

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
@@ -1707,7 +1707,9 @@ const Parser = function Parser(context, imports, fileInfo, currentIndex) {
17071707
}
17081708
// Treat like quoted values, but replace vars like unquoted expressions
17091709
const quote = new tree.Quoted('\'', item, true, index, fileInfo);
1710-
quote.variableRegex = /@([\w-]+)/g;
1710+
if (!item.startsWith('@{')) {
1711+
quote.variableRegex = /@([\w-]+)/g;
1712+
}
17111713
quote.propRegex = /\$([\w-]+)/g;
17121714
result.push(quote);
17131715
}

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

+3
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,6 @@
6969
mul-px-2: 140px;
7070
mul-px-3: 140px;
7171
}
72+
.radio_checked {
73+
border-color: #fff;
74+
}

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

+11
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,14 @@
125125
mul-px-3: ((@px * 1) * @cm);
126126
}
127127
}
128+
129+
@a1: 1px;
130+
@b2: 2px;
131+
@c3: @a1 + @b2;
132+
133+
@radio-cls: radio;
134+
@radio-cls-checked: @{radio-cls}_checked;
135+
136+
.@{radio-cls-checked} {
137+
border-color: #fff;
138+
}

0 commit comments

Comments
 (0)