Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes less#3675 - LESS detects @apply as variable (ISSUE) #3798

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/less/src/less/tree/expression.js
Expand Up @@ -45,7 +45,7 @@ Expression.prototype = Object.assign(new Node(), {
if (inParenthesis) {
context.outOfParenthesis();
}
if (this.parens && this.parensInOp && !mathOn && !doubleParen
if (this.parens && this.parensInOp && !mathOn && !doubleParen
&& (!(returnValue instanceof Dimension))) {
returnValue = new Paren(returnValue);
}
Expand Down
10 changes: 9 additions & 1 deletion packages/less/src/less/tree/quoted.js
Expand Up @@ -34,7 +34,15 @@ Quoted.prototype = Object.assign(new Node(), {
const that = this;
let value = this.value;
const variableReplacement = function (_, name) {
const v = new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context, true);
let v;
try {
v = new Variable(`@${name}`, that.getIndex(), that.fileInfo()).eval(context, true);
} catch (e) {
if (e.type !== 'Name') {
throw e;
}
return `@${name}`;
}
return (v instanceof Quoted) ? v.value : v.toCSS();
};
const propertyReplacement = function (_, name) {
Expand Down
2 changes: 1 addition & 1 deletion packages/less/test/browser/generator/runner.config.js
Expand Up @@ -183,4 +183,4 @@ module.exports = {
outfile: 'tmp/browser/test-runner-filemanager-plugin.html'
}
}
}
}
5 changes: 5 additions & 0 deletions packages/test-data/css/_main/atrule-passthrough.css
@@ -0,0 +1,5 @@
.test {
--iron-autogrow-textarea: {
@apply --app-font-monospace;
};
}
5 changes: 5 additions & 0 deletions packages/test-data/less/_main/atrule-passthrough.less
@@ -0,0 +1,5 @@
.test {
--iron-autogrow-textarea: {
@apply --app-font-monospace;
}
}