Fix @import file loading routine
Again, old fs.open syntax is deprecated, replaced with fs.readFile.
This commit is contained in:
parent
8e846a3b11
commit
ef71bb0db2
@ -99,24 +99,16 @@ less.Parser.importer = function (file, paths, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pathname) {
|
if (pathname) {
|
||||||
fs.stat(pathname, function (e, stats) {
|
fs.readFile(pathname, 'utf-8', function(e, data) {
|
||||||
if (e) sys.error(e);
|
if (e) sys.error(e);
|
||||||
|
|
||||||
fs.open(pathname, process.O_RDONLY, stats.mode, function (e, fd) {
|
new(less.Parser)({
|
||||||
if (e) sys.error(e);
|
paths: [path.dirname(pathname)],
|
||||||
|
filename: pathname
|
||||||
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
|
}).parse(data, function (e, root) {
|
||||||
if (e) sys.error(e);
|
if (e) less.writeError(e);
|
||||||
|
callback(root);
|
||||||
new(less.Parser)({
|
});
|
||||||
paths: [path.dirname(pathname)],
|
|
||||||
filename: pathname
|
|
||||||
}).parse(data, function (e, root) {
|
|
||||||
if (e) less.writeError(e);
|
|
||||||
callback(root);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sys.error("file '" + file + "' wasn't found.\n");
|
sys.error("file '" + file + "' wasn't found.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user