Revert "Add more options to beautify-css.js"

This commit is contained in:
tophf 2017-03-29 02:58:45 +03:00
parent 6be903e2ad
commit 1cfd2752d5

View File

@ -62,19 +62,12 @@
(function() { (function() {
function css_beautify(source_text, options) { function css_beautify(source_text, options) {
function defaultOption(opt, defaultValue) {
return opt === undefined ? defaultValue : opt;
}
options = options || {}; options = options || {};
var indentSize = options.indent_size || 4; var indentSize = options.indent_size || 4;
var indentCharacter = options.indent_char || ' '; var indentCharacter = options.indent_char || ' ';
var selectorSeparatorNewline = defaultOption(options.selector_separator_newline, true); var selectorSeparatorNewline = (options.selector_separator_newline === undefined) ? true : options.selector_separator_newline;
var end_with_newline = defaultOption(options.end_with_newline, false); var end_with_newline = (options.end_with_newline === undefined) ? false : options.end_with_newline;
var newline_between_rules = defaultOption(options.newline_between_rules, true); var newline_between_rules = (options.newline_between_rules === undefined) ? true : options.newline_between_rules;
var newline_between_properties = defaultOption(options.newline_between_properties, true);
var newline_before_open_brace = defaultOption(options.newline_before_open_brace, false);
var newline_after_open_brace = defaultOption(options.newline_after_open_brace, true);
var newline_before_close_brace = defaultOption(options.newline_before_close_brace, true);
// compatibility // compatibility
if (typeof indentSize === "string") { if (typeof indentSize === "string") {
@ -203,12 +196,12 @@
var print = {}; var print = {};
print["{"] = function(ch) { print["{"] = function(ch) {
newline_before_open_brace ? output.push('\n') : print.singleSpace(); print.singleSpace();
output.push(ch); output.push(ch);
newline_after_open_brace ? print.newLine() : print.singleSpace(); print.newLine();
}; };
print["}"] = function(ch) { print["}"] = function(ch) {
newline_before_close_brace ? print.newLine() : print.singleSpace(); print.newLine();
output.push(ch); output.push(ch);
print.newLine(); print.newLine();
}; };
@ -363,7 +356,7 @@
output.push(eatString(ch)); output.push(eatString(ch));
} else if (ch === ';') { } else if (ch === ';') {
output.push(ch); output.push(ch);
newline_between_properties ? print.newLine() : print.singleSpace(); print.newLine();
} else if (ch === '(') { // may be a url } else if (ch === '(') { // may be a url
if (lookBack("url")) { if (lookBack("url")) {
output.push(ch); output.push(ch);