made parser reentrant for import support

This commit is contained in:
cloudhead 2010-03-21 19:17:37 -04:00
parent 35649b320f
commit ef97105ce3
4 changed files with 749 additions and 711 deletions

View File

@ -17,7 +17,7 @@ fs.stat(file, function (e, stats) {
start = new(Date);
less.parser.parse(data, function (err, tree) {
new(less.Parser)().parse(data, function (err, tree) {
end = new(Date);
total = end - start;

View File

@ -42,7 +42,9 @@ fs.stat(input, function (e, stats) {
}
fs.open(input, process.O_RDONLY, stats.mode, function (e, fd) {
fs.read(fd, stats.size, 0, "utf8", function (e, data) {
less.parser.parse(data, function (err, tree) {
new(less.Parser)({
paths: [path.dirname(input)]
}).parse(data, function (err, tree) {
if (err) {
process.stdio.writeError(err);
} else {

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,9 @@ function toCSS(path, callback) {
read(path, function (e, str) {
if (e) { return callback(e) }
less.parser.parse(str, function (err, tree) {
new(less.Parser)({
paths: [require('path').dirname(path)]
}).parse(str, function (err, tree) {
if (err) {
callback(err);
} else {