added base 64 encoding for rhino, fixes urls.less test case

This commit is contained in:
Oliver Becker
2013-11-15 16:15:30 +01:00
parent b02d35891e
commit eff7341d98
3 changed files with 124 additions and 94 deletions

4
lib/less/encoder.js Normal file
View File

@@ -0,0 +1,4 @@
// base64 encoder implementation for node
exports.encodeBase64 = function(str) {
return new Buffer(str).toString('base64');
};

View File

@@ -579,9 +579,8 @@ tree.functions = {
'<rect ' + rectangleDimension + ' fill="url(#gradient)" /></svg>';
if (useBase64) {
// only works in node, needs interface to what is supported in environment
try {
returner = new Buffer(returner).toString('base64');
returner = require('./encoder').encodeBase64(returner); // TODO browser implementation
} catch(e) {
useBase64 = false;
}