8000 (dist) hot-fix 1.2.0 · recomputing/less.js@7eb079d · GitHub
[go: up one dir, main page]

Skip to content

Commit 7eb079d

Browse files
committed
(dist) hot-fix 1.2.0
1 parent 4cb962c commit 7eb079d

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

dist/less-1.2.0.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ var less, tree;
138138
if (typeof environment === "object" && ({}).toString.call(environment) === "[object Environment]") {
139139
// Rhino
140140
// Details on how to detect Rhino: https://github.com/ringo/ringojs/issues/88
141-
less = {};
141+
if (typeof(window) === 'undefined') { less = {} }
142+
else { less = window.less = {} }
142143
tree = less.tree = {};
143144
less.mode = 'rhino';
144145
} else if (typeof(window) === 'undefined') {
@@ -208,18 +209,20 @@ less.Parser = function Parser(env) {
208209
queue: [], // Files which haven't been imported yet
209210
files: {}, // Holds the imported parse trees
210211
mime: env && env.mime, // MIME type of .less files
212+
error: null, // Error in parsing/evaluating an import
211213
push: function (path, callback) {
212214
var that = this;
213215
this.queue.push(path);
214216

215217
//
216218
// Import a file asynchronously
217219
//
218-
less.Parser.importer(path, this.paths, function (root) {
220+
less.Parser.importer(path, this.paths, function (e, root) {
219221
that.queue.splice(that.queue.indexOf(path), 1); // Remove the path from the queue
220222
that.files[path] = root; // Store the root
221223

222-
callback(root);
224+
if (e && !that.error) { that.error = e }
225+
callback(e, root);
223226

224227
if (that.queue.length === 0) { finish() } // Call `finish` if we're done importing
225228
}, env);
@@ -338,7 +341,7 @@ less.Parser = function Parser(env) {
338341

339342
this.type = e.type || 'SyntaxError';
340343
this.message = e.message;
341-
this.filename = env.filename;
344+
this.filename = e.filename || env.filename;
342345
this.index = e.index;
343346
this.line = typeof(line) === 'number' ? line + 1 : null;
344347
this.callLine = e.call && (getLocation(e.call) + 1);
@@ -499,6 +502,9 @@ less.Parser = function Parser(env) {
499502
} catch (e) {
500503
throw new(LessError)(e, env);
501504
}
505+
506+
if (parser.imports.error) { throw parser.imports.error }
507+
502508
if (options.yuicompress && less.mode === 'node') {
503509
return require('./cssmin').compressor.cssmin(css);
504510
} else if (options.compress) {
@@ -896,11 +902,12 @@ less.Parser = function Parser(env) {
896902
// the `{...}` block.
897903
//
898904
definition: function () {
899-
var name, params = [], match, ruleset, param, value, cond, memo;
900-
905+
var name, params = [], match, ruleset, param, value, cond;
901906
if ((input.charAt(i) !== '.' && input.charAt(i) !== '#') ||
902907
peek(/^[^{]*(;|})/)) return;
903908

909+
save();
910+
904911
if (match = $(/^([#.](?:[\w-]|\\(?:[a-fA-F0-9]{1,6} ?|[^a-fA-F0-9]))+)\s*\(/)) {
905912
name = match[1];
906913

@@ -921,8 +928,6 @@ less.Parser = function Parser(env) {
921928
}
922929
expect(')');
923930

924-
memo = i;
925-
926931
if ($(/^when/)) { // Guard
927932
cond = expect(this.conditions, 'expected condition');
928933
}
@@ -931,6 +936,8 @@ less.Parser = function Parser(env) {
931936

932937
if (ruleset) {
933938
return new(tree.mixin.Definition)(name, params, ruleset, cond);
939+
} else {
940+
restore();
934941
}
935942
}
936943
}
@@ -2203,10 +2210,7 @@ tree.Import = function (path, imports, features) {
22032210

22042211
// Only pre-compile .less files
22052212
if (! this.css) {
2206-
imports.push(this.path, function (root) {
2207-
if (! root) {
2208-
throw new(Error)("Error parsing " + that.path);
2209-
}
2213+
imports.push(this.path, function (e, root) {
22102214
that.root = root;
22112215
});
22122216
}

0 commit comments

Comments
 (0)
0