mirror of
https://github.com/less/less.js.git
synced 2026-05-01 03:00:22 -04:00
@@ -1,3 +1,5 @@
|
||||
var fs = require('fs');
|
||||
|
||||
(function (tree) {
|
||||
|
||||
tree.functions = {
|
||||
@@ -345,6 +347,18 @@ tree.functions = {
|
||||
},
|
||||
shade: function(color, amount) {
|
||||
return this.mix(this.rgb(0, 0, 0), color, amount);
|
||||
},
|
||||
"data-uri": function(mimetype, path) {
|
||||
var data = fs.readFileSync(path.value);
|
||||
mimetype = mimetype.value;
|
||||
|
||||
if (/;base64$/.test(mimetype)) {
|
||||
data = (new Buffer(data)).toString('base64');
|
||||
}
|
||||
|
||||
var contents = new(tree.Anonymous)('data:'+mimetype+','+data);
|
||||
|
||||
return new(tree.URL)(contents);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user