mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
support variables in url()
This commit is contained in:
@@ -519,10 +519,11 @@ less.Parser = function Parser(env) {
|
||||
var value;
|
||||
|
||||
if (input.charAt(i) !== 'u' || !$(/^url\(/)) return;
|
||||
value = $(this.entities.quoted) || $(/^[-\w%@$\/.&=:;#+?]+/);
|
||||
value = $(this.entities.quoted) || $(this.entities.variable) || $(/^[-\w%@$\/.&=:;#+?]+/);
|
||||
if (! $(')')) throw new(Error)("missing closing ) for url()");
|
||||
|
||||
return new(tree.URL)(value.value ? value : new(tree.Anonymous)(value));
|
||||
return new(tree.URL)((value.value || value instanceof tree.Variable)
|
||||
? value : new(tree.Anonymous)(value));
|
||||
},
|
||||
|
||||
//
|
||||
|
||||
@@ -7,7 +7,10 @@ tree.URL.prototype = {
|
||||
toCSS: function () {
|
||||
return "url(" + this.value.toCSS() + ")";
|
||||
},
|
||||
eval: function () { return this }
|
||||
eval: function (ctx) {
|
||||
this.value = this.value.eval(ctx);
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
})(require('less/tree'));
|
||||
|
||||
Reference in New Issue
Block a user