diff --git a/lib/less/parser.js b/lib/less/parser.js index 4b3efd541..799f3a575 100644 --- a/lib/less/parser.js +++ b/lib/less/parser.js @@ -1034,6 +1034,17 @@ less.Parser = function Parser(env) { furthest = i; restore(); } + } else if (name = $(this.entities.quoted)) { + $(/\s*:/); + value = $(this.value); + important = $(this.important); + + if (value && $(this.end)) { + return new(tree.Rule)(name, value, important, memo); + } else { + furthest = i; + restore(); + } } }, diff --git a/lib/less/tree/rule.js b/lib/less/tree/rule.js index 9e4e54a3a..5b14de281 100644 --- a/lib/less/tree/rule.js +++ b/lib/less/tree/rule.js @@ -6,22 +6,26 @@ tree.Rule = function (name, value, important, index, inline) { this.important = important ? ' ' + important.trim() : ''; this.index = index; this.inline = inline || false; + this.quotedName = false; - if (name.charAt(0) === '@') { + if (name instanceof tree.Quoted) { + this.quotedName = true; + } else if (name.charAt(0) === '@') { this.variable = true; } else { this.variable = false } }; tree.Rule.prototype.toCSS = function (env) { if (this.variable) { return "" } else { - return this.name + (env.compress ? ':' : ': ') + + return (this.quotedName ? this.name.toCSS(env) : this.name) + + (env.compress ? ':' : ': ') + this.value.toCSS(env) + this.important + (this.inline ? "" : ";"); } }; tree.Rule.prototype.eval = function (context) { - return new(tree.Rule)(this.name, + return new(tree.Rule)(this.quotedName ? this.name.eval(context) : this.name, this.value.eval(context), this.important, this.index, this.inline); diff --git a/test/css/variables.css b/test/css/variables.css index 961fe6959..78a2ef495 100644 --- a/test/css/variables.css +++ b/test/css/variables.css @@ -25,3 +25,7 @@ a:nth-child(2) { border: 1px; } +div { + -webkit-border-radius: 5px; + border-radius: 5px; +} diff --git a/test/less/variables.less b/test/less/variables.less index 66ab4efff..72b7583d6 100644 --- a/test/less/variables.less +++ b/test/less/variables.less @@ -16,6 +16,8 @@ @quotes: "~" "~"; @q: @quotes; +@property: "border-radius"; + .variables { height: @b + @x + 0px; // 24px color: @c; @@ -52,3 +54,8 @@ a:nth-child(@a) { border: 1px; } + +div { + ~"-webkit-@{property}": 5px; + ~"@{property}": 5px; +} \ No newline at end of file