diff --git a/packages/less/src/less/tree/expression.js b/packages/less/src/less/tree/expression.js index 957505b87..121492f9c 100644 --- a/packages/less/src/less/tree/expression.js +++ b/packages/less/src/less/tree/expression.js @@ -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); } diff --git a/packages/less/src/less/tree/quoted.js b/packages/less/src/less/tree/quoted.js index cb0d56b12..c6dbfd738 100644 --- a/packages/less/src/less/tree/quoted.js +++ b/packages/less/src/less/tree/quoted.js @@ -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) { diff --git a/packages/less/test/browser/generator/runner.config.js b/packages/less/test/browser/generator/runner.config.js index 8dc30ed58..f78d87e21 100644 --- a/packages/less/test/browser/generator/runner.config.js +++ b/packages/less/test/browser/generator/runner.config.js @@ -183,4 +183,4 @@ module.exports = { outfile: 'tmp/browser/test-runner-filemanager-plugin.html' } } -} \ No newline at end of file +} diff --git a/packages/test-data/css/_main/atrule-passthrough.css b/packages/test-data/css/_main/atrule-passthrough.css new file mode 100644 index 000000000..db0bdd0dd --- /dev/null +++ b/packages/test-data/css/_main/atrule-passthrough.css @@ -0,0 +1,5 @@ +.test { + --iron-autogrow-textarea: { + @apply --app-font-monospace; + }; +} diff --git a/packages/test-data/less/_main/atrule-passthrough.less b/packages/test-data/less/_main/atrule-passthrough.less new file mode 100644 index 000000000..25bea9210 --- /dev/null +++ b/packages/test-data/less/_main/atrule-passthrough.less @@ -0,0 +1,5 @@ +.test { + --iron-autogrow-textarea: { + @apply --app-font-monospace; + } +}