I wanted to program 3 scripts or addons, namely HTML Beautifier, CSS Beautifier and JS Beautifier.
My script looks something like this, but it doesn't work.
Code: Select all
import "beautify-css.js" // comma separated for multiple
// var section
var
css = "",
beautifyOptions = {
indent_size: 2, // Indentation size [4]
indent_char: " ", // Indentation character [" "]
indent_with_tabs: false, // Indent with tabs, overrides -s and -c
eol: "\n", // Character(s) to use as line terminators. (default newline - "\\n")
end_with_newline: true, // End output with newline
brace_style: "collapse", // [collapse|expand] ["collapse"]
selector_separator_newline: true, // Add a newline between multiple selectors
newline_between_rules: false, // Add a newline between CSS rules
indent_empty_lines: false, // Keep indentation on empty lines
space_around_selector_separator: true
}
;
// procedures and function
function p1() {
css_beautify = require("js-beautify").css;
css = Document.Text;
css = css_beautify(css);
Document.Text = css;
}
// Main procedure that will be executed when you run the script.
p1();