a JSON-formatted file indicated by the -config parameter.any jsbeautify_-prefixed environment variables.In addition to CLI arguments, you may pass config to the JS executable via: There are still aįew other additional cases keeping us from 100% API-compatibility. Notice not all defaults are exposed via the CLI. Which correspond to the underscored option keys for both library interfaces templating List of templating languages (auto,django,erb,handlebars,php,smarty) auto = none in JavaScript, all in HTML indent-empty-lines Keep indentation on empty lines O, -operator-position Set operator position (before-newline|after-newline|preserve-newline) C, -comma-first Put commas at the beginning of new line instead of end good-stuff Warm the cockles of Crockford's heart X, -e4x Pass E4X xml literals through untouched w, -wrap-line-length Wrap lines that exceed N characters x, -unescape-strings Decode printable characters encoded in xNN notation k, -keep-array-indentation Preserve array indentation B, -break-chained-methods Break chained method calls across subsequent lines u, -unindent-chained-methods Don't indent chained method calls space-after-named-function Add a space before a named function's parens, i.e. a, -space-after-anon-function Add a space before an anonymous function's parens, ie. j, -jslint-happy Enable jslint-stricter mode E, -space-in-empty-paren Add a single space inside empty paren, ie. P, -space-in-paren Add padding spaces within paren, ie. m, -max-preserve-newlines Number of line-breaks to be preserved in one chunk p, -preserve-newlines Preserve line-breaks (-no-preserve-newlines disables) l, -indent-level Initial indentation level editorconfig Use EditorConfig to set up the options n, -end-with-newline End output with newline e, -eol Character(s) to use as line terminators. t, -indent-with-tabs Indent with tabs, overrides -s and -c type Select beautifier type (NOTE: Does *not* filter files, only defines which beautifier type to run) o, -outfile Write output to file (default stdout) r, -replace Write output in-place, replacing input f, -file Input file(s) (Pass '-' for stdin) These are the command-line flags for both Python and JS scripts: CLI Options: The example above would be set on the command-line as -indent-size 2 -space-in-empty-paren. The configuration option names are the same as the CLI names but with underscores instead of dashes. space_in_empty_paren = True res = jsbeautifier. As with the Python script, the beautified result is sent to stdout unless otherwise configured. When installed globally, it provides an executable js-beautify script. You may install the NPM package js-beautify. You can install the beautifier for Node.js or Python. If you are interested, please take a look at the CONTRIBUTING.md then fix an issue marked with the "Good first issue" label and submit a PR. This is a popular project and widely used but it desperately needs contributors who have time to commit to fixing bothĬustomer facing bugs and underlying problems with the internal design and implementation. I'm putting this front and center above because existing owners have very limited time to work on this project currently. JavaScript, unpack scripts packed by Dean Edward’s popular packer,Īs well as partly deobfuscate scripts processed by the npm package This little beautifier will reformat and re-indent bookmarklets, ugly
0 Comments
Leave a Reply. |