mirror of
https://github.com/less/less.js.git
synced 2026-02-13 08:25:09 -05:00
get closer moving tab control away replacing text after converting to css
This commit is contained in:
@@ -11,7 +11,7 @@ tree.Comment.prototype = {
|
||||
if (this.debugInfo) {
|
||||
output.add(tree.debugInfo(env, this));
|
||||
}
|
||||
output.add(this.value);
|
||||
output.add(this.value.trim()); //TODO shouldn't need to trim, we shouldn't grab the \n
|
||||
},
|
||||
toCSS: tree.toCSS,
|
||||
isSilent: function(env) {
|
||||
|
||||
@@ -31,9 +31,9 @@ tree.Directive.prototype = {
|
||||
css += tabRuleStr + this.rules[i].toCSS(env) + (env.compress ? "" : "\n");
|
||||
}
|
||||
env.tabLevel--;
|
||||
return this.name + (env.compress ? '{' : ' {\n') + css + (env.compress ? '}': (tabSetStr + '}\n'));
|
||||
return this.name + (env.compress ? '{' : ' {\n') + css + (env.compress ? '}': (tabSetStr + '}'));
|
||||
} else {
|
||||
return this.name + ' ' + this.value.toCSS() + ';\n';
|
||||
return this.name + ' ' + this.value.toCSS() + ';';
|
||||
}
|
||||
},
|
||||
eval: function (env) {
|
||||
|
||||
@@ -28,13 +28,13 @@ tree.Media.prototype = {
|
||||
tabSetStr = env.compress ? '' : Array(env.tabLevel).join(" ");
|
||||
var css = "";
|
||||
for(var i = 0; i < this.rules.length; i++) {
|
||||
css += tabRuleStr + this.rules[i].toCSS(env) + (env.compress ? '\n' : '');
|
||||
css += tabRuleStr + this.rules[i].toCSS(env) + (env.compress ? '' : '\n');
|
||||
}
|
||||
env.tabLevel--;
|
||||
|
||||
if (css.match(/\S/)) {
|
||||
return '@media ' + features + (env.compress ? '{' : ' {\n') + css +
|
||||
(env.compress ? '}': '}\n');
|
||||
'}';
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -189,7 +189,8 @@ tree.Ruleset.prototype = {
|
||||
rulesets = [], // node.Ruleset instances
|
||||
selector, // The fully rendered selector
|
||||
debugInfo, // Line number debugging
|
||||
rule;
|
||||
rule,
|
||||
ruleCSS;
|
||||
|
||||
this.mergeRules();
|
||||
|
||||
@@ -218,7 +219,10 @@ tree.Ruleset.prototype = {
|
||||
rules.push(rule.value.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rules = rules.filter(function(rule) { return !!rule; });
|
||||
rulesets = rulesets.filter(function(rule) { return !!rule; });
|
||||
|
||||
// Remove last semicolon
|
||||
if (env.compress && rules.length) {
|
||||
@@ -231,14 +235,14 @@ tree.Ruleset.prototype = {
|
||||
var tabRuleStr = env.compress ? '' : Array(env.tabLevel + 1).join(" "),
|
||||
tabSetStr = env.compress ? '' : Array(env.tabLevel).join(" ");
|
||||
|
||||
rulesets = rulesets.join(this.root ? tabRuleStr : tabSetStr);
|
||||
rulesets = rulesets.join('\n' + (this.root ? tabRuleStr : tabSetStr));
|
||||
|
||||
// If this is the root node, we don't render
|
||||
// a selector, or {}.
|
||||
// Otherwise, only output if this ruleset has rules.
|
||||
if (this.root) {
|
||||
if (rules.length > 0) {
|
||||
css.push(rules.join(env.compress ? '' : ('\n' + tabRuleStr)));
|
||||
css.push(rules.join(env.compress ? '' : ('\n' + tabRuleStr))/* + '\n'*/);
|
||||
}
|
||||
} else {
|
||||
if (rules.length > 0) {
|
||||
@@ -267,7 +271,7 @@ tree.Ruleset.prototype = {
|
||||
css.push(selector +
|
||||
(env.compress ? '{' : ' {\n') + tabRuleStr +
|
||||
rules.join(env.compress ? '' : ('\n' + tabRuleStr)) +
|
||||
(env.compress ? '}' : '\n' + tabSetStr + '}\n'));
|
||||
(env.compress ? '}' : '\n' + tabSetStr + '}'));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -282,7 +286,7 @@ tree.Ruleset.prototype = {
|
||||
|
||||
css.push(rulesets);
|
||||
|
||||
return css.join('') + (env.compress ? '\n' : '');
|
||||
return css.join('') + (!env.compress && this.firstRoot ? '\n' : '');
|
||||
},
|
||||
|
||||
toCSSRoot: function (env) {
|
||||
|
||||
Reference in New Issue
Block a user