function OutputLine(parent) { this.__parent = parent; this.__character_count = 0; // use indent_count as a marker for this.__lines that have preserved indentation this.__indent_count = -1; this.__alignment_count = 0; this.__wrap_point_index = 0; this.__wrap_point_character_count = 0; this.__wrap_point_indent_count = -1; this.__wrap_point_alignment_count = 0;
this.__items = [];
}
OutputLine.prototype.clone_empty = function() { var line = new OutputLine(this.__parent);
line.set_indent(this.__indent_count, this.__alignment_count); return line;
};
OutputLine.prototype.toString = function() { var result = ''; if (this.is_empty()) { if (this.__parent.indent_empty_lines) {
result = this.__parent.get_indent_string(this.__indent_count);
}
} else {
result = this.__parent.get_indent_string(this.__indent_count, this.__alignment_count);
result += this.__items.join('');
} return result;
};
function IndentStringCache(options, baseIndentString) { this.__cache = ['']; this.__indent_size = options.indent_size; this.__indent_string = options.indent_char; if (!options.indent_with_tabs) { this.__indent_string = new Array(options.indent_size + 1).join(options.indent_char);
}
// Set to null to continue support for auto detection of base indent
baseIndentString = baseIndentString || ''; if (options.indent_level > 0) {
baseIndentString = new Array(options.indent_level + 1).join(this.__indent_string);
}
Output.prototype.add_new_line = function(force_newline) { // never newline at the start of file // otherwise, newline only if we didn't just add one or we're forced if (this.is_empty() ||
(!force_newline && this.just_added_newline())) { returnfalse;
}
// if raw output is enabled, don't print additional newlines, // but still return True as though you had if (!this.raw) { this.__add_outputline();
} returntrue;
};
// handle some edge cases where the last tokens // has text that ends with newline(s) var last_item = this.current_line.pop(); if (last_item) { if (last_item[last_item.length - 1] === '\n') {
last_item = last_item.replace(/\n+$/g, '');
} this.current_line.push(last_item);
}
if (this._end_with_newline) { this.__add_outputline();
}
// Next line stores alignment values this.next_line.set_indent(indent, alignment);
// Never indent your first output indent at the start of the file if (this.__lines.length > 1) { this.current_line.set_indent(indent, alignment); returntrue;
}
this.current_line.set_indent(); returnfalse;
};
Output.prototype.add_raw_token = function(token) { for (var x = 0; x < token.newlines; x++) { this.__add_outputline();
} this.current_line.set_indent(-1); this.current_line.push(token.whitespace_before); this.current_line.push(token.text); this.space_before_token = false; this.non_breaking_space = false; this.previous_token_wrapped = false;
};
// indent_size behavior changed after 1.8.6 // It used to be that indent_size would be // set to 1 for indent_with_tabs. That is no longer needed and // actually doesn't make sense - why not use spaces? Further, // that might produce unexpected behavior - tabs being used // for single-column alignment. So, when indent_with_tabs is true // and indent_size is 1, reset indent_size to 4. if (this.indent_size === 1) { this.indent_size = 4;
}
}
// Backwards compat with 1.3.x this.wrap_line_length = this._get_number('wrap_line_length', this._get_number('max_char'));
// valid templating languages ['django', 'erb', 'handlebars', 'php'] // For now, 'auto' = all off for javascript, all on for html (and inline javascript). // other values ignored this.templating = this._get_selection_list('templating', ['auto', 'none', 'django', 'erb', 'handlebars', 'php'], ['auto']);
}
Options.prototype._get_array = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || []; if (typeof option_value === 'object') { if (option_value !== null && typeof option_value.concat === 'function') {
result = option_value.concat();
}
} elseif (typeof option_value === 'string') {
result = option_value.split(/[^a-zA-Z0-9_\/\-]+/);
} return result;
};
Options.prototype._get_boolean = function(name, default_value) { var option_value = this.raw_options[name]; var result = option_value === undefined ? !!default_value : !!option_value; return result;
};
Options.prototype._get_characters = function(name, default_value) { var option_value = this.raw_options[name]; var result = default_value || ''; if (typeof option_value === 'string') {
result = option_value.replace(/\\r/, '\r').replace(/\\n/, '\n').replace(/\\t/, '\t');
} return result;
};
Options.prototype._get_number = function(name, default_value) { var option_value = this.raw_options[name];
default_value = parseInt(default_value, 10); if (isNaN(default_value)) {
default_value = 0;
} var result = parseInt(option_value, 10); if (isNaN(result)) {
result = default_value;
} return result;
};
Options.prototype._get_selection = function(name, selection_list, default_value) { var result = this._get_selection_list(name, selection_list, default_value); if (result.length !== 1) { thrownew Error( "Invalid Option Value: The option '" + name + "' can only be one of the following values:\n" +
selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
}
return result[0];
};
Options.prototype._get_selection_list = function(name, selection_list, default_value) { if (!selection_list || selection_list.length === 0) { thrownew Error("Selection list cannot be empty.");
}
var result = this._get_array(name, default_value); if (!this._is_valid_selection(result, selection_list)) { thrownew Error( "Invalid Option Value: The option '" + name + "' can contain only the following values:\n" +
selection_list + "\nYou passed in: '" + this.raw_options[name] + "'");
}
// merges child options up with the parent options object // Example: obj = {a: 1, b: {a: 2}} // mergeOpts(obj, 'b') // // Returns: {a: 2} function _mergeOpts(allOptions, childFieldName) { var finalOpts = {};
allOptions = _normalizeOpts(allOptions); var name;
for (name in allOptions) { if (name !== childFieldName) {
finalOpts[name] = allOptions[name];
}
}
//merge in the per type settings for the childFieldName if (childFieldName && allOptions[childFieldName]) { for (name in allOptions[childFieldName]) {
finalOpts[name] = allOptions[childFieldName][name];
}
} return finalOpts;
}
function _normalizeOpts(options) { var convertedOpts = {}; var key;
for (key in options) { var newKey = key.replace(/-/g, "_");
convertedOpts[newKey] = options[key];
} return convertedOpts;
}
InputScanner.prototype.next = function() { var val = null; if (this.hasNext()) {
val = this.__input.charAt(this.__position); this.__position += 1;
} return val;
};
InputScanner.prototype.peek = function(index) { var val = null;
index = index || 0;
index += this.__position; if (index >= 0 && index < this.__input_length) {
val = this.__input.charAt(index);
} return val;
};
// This is a JavaScript only helper function (not in python) // Javascript doesn't have a match method // and not all implementation support "sticky" flag. // If they do not support sticky then both this.match() and this.test() method // must get the match and check the index of the match. // If sticky is supported and set, this method will use it. // Otherwise it will check that global is set, and fall back to the slower method.
InputScanner.prototype.__match = function(pattern, index) {
pattern.lastIndex = index; var pattern_match = pattern.exec(this.__input);
if (pattern_match && !(regexp_has_sticky && pattern.sticky)) { if (pattern_match.index !== index) {
pattern_match = null;
}
}
return pattern_match;
};
InputScanner.prototype.test = function(pattern, index) {
index = index || 0;
index += this.__position;
if (index >= 0 && index < this.__input_length) { return !!this.__match(pattern, index);
} else { returnfalse;
}
};
InputScanner.prototype.testChar = function(pattern, index) { // test one character regex match var val = this.peek(index);
pattern.lastIndex = 0; return val !== null && pattern.test(val);
};
InputScanner.prototype.read = function(starting_pattern, until_pattern, until_after) { var val = ''; var match; if (starting_pattern) {
match = this.match(starting_pattern); if (match) {
val += match[0];
}
} if (until_pattern && (match || !starting_pattern)) {
val += this.readUntil(until_pattern, until_after);
} return val;
};
InputScanner.prototype.readUntil = function(pattern, until_after) { var val = ''; var match_index = this.__position;
pattern.lastIndex = this.__position; var pattern_match = pattern.exec(this.__input); if (pattern_match) {
match_index = pattern_match.index; if (until_after) {
match_index += pattern_match[0].length;
}
} else {
match_index = this.__input_length;
}
val = this.__input.substring(this.__position, match_index); this.__position = match_index; return val;
};
InputScanner.prototype.get_regexp = function(pattern, match_from) { var result = null; var flags = 'g'; if (match_from && regexp_has_sticky) {
flags = 'y';
} // strings are converted to regexp if (typeof pattern === "string" && pattern !== '') { // result = new RegExp(pattern.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), flags);
result = new RegExp(pattern, flags);
} elseif (pattern) {
result = new RegExp(pattern.source, flags);
} return result;
};
var Options = __webpack_require__(17).Options; var Output = __webpack_require__(2).Output; var InputScanner = __webpack_require__(8).InputScanner; var Directives = __webpack_require__(13).Directives;
var directives_core = new Directives(/\/\*/, /\*\//);
var lineBreak = /\r\n|[\r\n]/; var allLineBreaks = /\r\n|[\r\n]/g;
// tokenizer var whitespaceChar = /\s/; var whitespacePattern = /(?:\s|\n)+/g; var block_comment_pattern = /\/\*(?:[\s\S]*?)((?:\*\/)|$)/g; var comment_pattern = /\/\/(?:[^\n\r\u2028\u2029]*)/g;
function Beautifier(source_text, options) { this._source_text = source_text || ''; // Allow the setting of language/file-type specific options // with inheritance of overall settings this._options = new Options(options); this._ch = null; this._input = null;
Beautifier.prototype.eatString = function(endChars) { var result = ''; this._ch = this._input.next(); while (this._ch) {
result += this._ch; if (this._ch === "\\") {
result += this._input.next();
} elseif (endChars.indexOf(this._ch) !== -1 || this._ch === "\n") { break;
} this._ch = this._input.next();
} return result;
};
// Skips any white space in the source text from the current position. // When allowAtLeastOneNewLine is true, will output new lines for each // newline character found; if the user has preserve_newlines off, only // the first newline will be output
Beautifier.prototype.eatWhitespace = function(allowAtLeastOneNewLine) { var result = whitespaceChar.test(this._input.peek()); var isFirstNewLine = true;
while (whitespaceChar.test(this._input.peek())) { this._ch = this._input.next(); if (allowAtLeastOneNewLine && this._ch === '\n') { if (this._options.preserve_newlines || isFirstNewLine) {
isFirstNewLine = false; this._output.add_new_line(true);
}
}
} return result;
};
// Nested pseudo-class if we are insideRule // and the next special character found opens // a new block
Beautifier.prototype.foundNestedPseudoClass = function() { var openParen = 0; var i = 1; var ch = this._input.peek(i); while (ch) { if (ch === "{") { returntrue;
} elseif (ch === '(') { // pseudoclasses can contain ()
openParen += 1;
} elseif (ch === ')') { if (openParen === 0) { returnfalse;
}
openParen -= 1;
} elseif (ch === ";" || ch === "}") { returnfalse;
}
i++;
ch = this._input.peek(i);
} returnfalse;
};
Beautifier.prototype.beautify = function() { if (this._options.disabled) { returnthis._source_text;
}
var source_text = this._source_text; var eol = this._options.eol; if (eol === 'auto') {
eol = '\n'; if (source_text && lineBreak.test(source_text || '')) {
eol = source_text.match(lineBreak)[0];
}
}
// HACK: newline parsing inconsistent. This brute force normalizes the this._input.
source_text = source_text.replace(allLineBreaks, '\n');
// reset var baseIndentString = source_text.match(/^[\t ]*/)[0];
this._output = new Output(this._options, baseIndentString); this._input = new InputScanner(source_text); this._indentLevel = 0; this._nestedLevel = 0;
this._ch = null; var parenLevel = 0;
var insideRule = false; // This is the value side of a property value pair (blue in the following ex) // label { content: blue } var insidePropertyValue = false; var enteringConditionalGroup = false; var insideAtExtend = false; var insideAtImport = false; var topCharacter = this._ch; var whitespace; var isAfterSpace; var previous_ch;
if (!this._ch) { break;
} elseif (this._ch === '/' && this._input.peek() === '*') { // /* css comment */ // Always start block comments on a new line. // This handles scenarios where a block comment immediately // follows a property definition on the same line or where // minified code is being beautified. this._output.add_new_line(); this._input.back();
var comment = this._input.read(block_comment_pattern);
// Handle ignore directive var directives = directives_core.get_directives(comment); if (directives && directives.ignore === 'start') {
comment += directives_core.readIgnored(this._input);
}
this.print_string(comment);
// Ensures any new lines following the comment are preserved this.eatWhitespace(true);
// Block comments are followed by a new line so they don't // share a line with other properties this._output.add_new_line();
} elseif (this._ch === '/' && this._input.peek() === '/') { // // single line comment // Preserves the space before a comment // on the same line as a rule this._output.space_before_token = true; this._input.back(); this.print_string(this._input.read(comment_pattern));
// Ensures any new lines following the comment are preserved this.eatWhitespace(true);
} elseif (this._ch === '@') { this.preserveSingleSpace(isAfterSpace);
// deal with less propery mixins @{...} if (this._input.peek() === '{') { this.print_string(this._ch + this.eatString('}'));
} else { this.print_string(this._ch);
// strip trailing space, if present, for hash property checks var variableOrRule = this._input.peekUntilAfter(/[: ,;{}()[\]\/='"]/g);
if (variableOrRule.match(/[ :]$/)) { // we have a variable or pseudo-class, add it and insert one space before continuing
variableOrRule = this.eatString(": ").replace(/\s$/, ''); this.print_string(variableOrRule); this._output.space_before_token = true;
}
// might be a nesting at-rule if (variableOrRule in this.NESTED_AT_RULE) { this._nestedLevel += 1; if (variableOrRule in this.CONDITIONAL_GROUP_RULE) {
enteringConditionalGroup = true;
} // might be less variable
} elseif (!insideRule && parenLevel === 0 && variableOrRule.indexOf(':') !== -1) {
insidePropertyValue = true; this.indent();
}
}
} elseif (this._ch === '#' && this._input.peek() === '{') { this.preserveSingleSpace(isAfterSpace); this.print_string(this._ch + this.eatString('}'));
} elseif (this._ch === '{') { if (insidePropertyValue) {
insidePropertyValue = false; this.outdent();
}
// when entering conditional groups, only rulesets are allowed if (enteringConditionalGroup) {
enteringConditionalGroup = false;
insideRule = (this._indentLevel >= this._nestedLevel);
} else { // otherwise, declarations are also allowed
insideRule = (this._indentLevel >= this._nestedLevel - 1);
} if (this._options.newline_between_rules && insideRule) { if (this._output.previous_line && this._output.previous_line.item(-1) !== '{') { this._output.ensure_empty_line_above('/', ',');
}
}
this._output.space_before_token = true;
// The difference in print_string and indent order is necessary to indent the '{' correctly if (this._options.brace_style === 'expand') { this._output.add_new_line(); this.print_string(this._ch); this.indent(); this._output.set_indent(this._indentLevel);
} else { this.indent(); this.print_string(this._ch);
}
var brace_style_split = this._get_selection_list('brace_style', ['collapse', 'expand', 'end-expand', 'none', 'preserve-inline']); this.brace_style = 'collapse'; for (var bs = 0; bs < brace_style_split.length; bs++) { if (brace_style_split[bs] !== 'expand') { // default to collapse, as only collapse|expand is implemented for now this.brace_style = 'collapse';
} else { this.brace_style = brace_style_split[bs];
}
}
}
Options.prototype = new BaseOptions();
module.exports.Options = Options;
/***/ }) /******/ ]); var css_beautify = legacy_beautify_css; /* Footer */ if (typeof define === "function" && define.amd) { // Add support for AMD ( https://github.com/amdjs/amdjs-api/wiki/AMD#defineamd-property- )
define([], function() { return {
css_beautify: css_beautify
};
});
} elseif (typeof exports !== "undefined") { // Add support for CommonJS. Just put this file somewhere on your require.paths // and you will be able to `var html_beautify = require("beautify").html_beautify`.
exports.css_beautify = css_beautify;
} elseif (typeof window !== "undefined") { // If we're running a web page and don't have either of the above, add our one global
window.css_beautify = css_beautify;
} elseif (typeof global !== "undefined") { // If we don't even have window, try global.
global.css_beautify = css_beautify;
}
}());
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.30 Sekunden
(vorverarbeitet am 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.