mirror of
https://github.com/less/less.js.git
synced 2026-02-03 19:45:00 -05:00
Fixed incorrect inputLength. Avoid creating multiple empty chucks for consecutive blank lines.
This commit is contained in:
committed by
Alexis Sellier
parent
0b30fe48c9
commit
05165ce90d
@@ -188,21 +188,21 @@ less.Parser = function Parser(env) {
|
||||
i = j = current = furthest = 0;
|
||||
chunks = [];
|
||||
input = str.replace(/\r\n/g, '\n');
|
||||
inputLength = input.length;
|
||||
|
||||
// Split the input into chunks,
|
||||
// Either delimited by /\n\n/ or
|
||||
// delmited by '\n}' (see rationale above),
|
||||
// delimited by /\n\n/ and
|
||||
// removing comments (see rationale above),
|
||||
// depending on the level of optimization.
|
||||
if (that.optimization > 0) {
|
||||
input = input.replace(/\/\*(?:[^*]|\*+[^\/*])*\*+\//g, function (comment) {
|
||||
return that.optimization > 1 ? '' : comment.replace(/\n\n+/g, '\n');
|
||||
return that.optimization > 1 ? '' : comment.replace(/\n(\s*\n)+/g, '\n');
|
||||
});
|
||||
chunks = input.split(/^(?=\n)/mg);
|
||||
chunks = input.split(/^(?=(\s*\n)+)/mg);
|
||||
} else {
|
||||
chunks = [input];
|
||||
}
|
||||
|
||||
inputLength = input.length;
|
||||
|
||||
// Start with the primary rule.
|
||||
// The whole syntax tree is held under a Ruleset node,
|
||||
|
||||
Reference in New Issue
Block a user