Skip to content

Commit

Permalink
Fixed issue with import less files.
Browse files Browse the repository at this point in the history
  • Loading branch information
spocke committed Jun 12, 2013
1 parent bbb2092 commit a99d534
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions tools/BuildTools.js
Expand Up @@ -89,47 +89,6 @@ exports.less = function (options) {
strictImports: options.strictImports
});

// Patch over BOM bug
// Todo: Remove this when they fix the bug
less.Parser.importer = function (file, paths, callback, env) {
var pathname;

paths.unshift('.');

for (var i = 0; i < paths.length; i++) {
try {
pathname = path.join(paths[i], file);
fs.statSync(pathname);
break;
} catch (e) {
pathname = null;
}
}

if (pathname) {
fs.readFile(pathname, 'utf-8', function(e, data) {
if (e) {
return callback(e);
}

data = data.replace(/^\uFEFF/, '');

new(less.Parser)({
paths: [path.dirname(pathname)].concat(paths),
filename: pathname
}).parse(data, function (e, root) {
callback(e, root, data);
});
});
} else {
if (typeof(env.errback) === "function") {
env.errback(file, paths, callback);
} else {
callback({ type: 'File', message: "'" + file + "' wasn't found.\n" });
}
}
};

// Parse one or multiple files
if (sourceFile instanceof Array) {
sourceFile.forEach(function(sourceFile) {
Expand Down

0 comments on commit a99d534

Please sign in to comment.