web-beautify
web-beautify copied to clipboard
Typical format for .jsbeautifyrc is ignored.
Hi, so I was using web-beautify without a .jsbeautifyrc file until recently, when I needed to change the indent_size for scss files to be 2. That's when I realized the typical .jsbeautifyrc format is ignored. When I use the below:
{ "indent_size": 2, "indent_char": " ", "eol": "\n", "indent_level": 0, "indent_with_tabs": false, "preserve_newlines": true, "max_preserve_newlines": 10, "jslint_happy": false, "space_after_anon_function": false, "brace_style": "collapse", "keep_array_indentation": false, "keep_function_indentation": false, "space_before_conditional": true, "break_chained_methods": false, "eval_code": false, "unescape_strings": false, "wrap_line_length": 0, "wrap_attributes": "auto", "wrap_attributes_indent_size": 4, "end_with_newline": false }
, web-beautify works great and indents my js file as per expected. But once I added the css and html objects (the typical way it is with other editors) like the below:
{ "html": { //rules here }, "css": { // rules here }, "js": { // rules here } }
, web-beautify stops working, and it doesn't even read the original js segment. It's only until I took out the js segment and put it on its own like in my first example does web-beautify work again.
Can somebody please enlighten me as to how exactly I should be formatting my .jsbeautifyrc so that web-beautify understands the options for HTML CSS and JS? Thanks.
@Uebyn Sorry for the late reply. If you still interested in this issue, let me know following the information.
- OS and version
- node version
- js-beautify version
Hi, thanks for your reply. Here you go:
- OS X Yosemite Version 10.10.5
- v4.5.0
- 1.6.4 (as seen below)
/usr/local/bin/css-beautify -> /usr/local/lib/node_modules/js-beautify/js/bin/css-beautify.js /usr/local/bin/html-beautify -> /usr/local/lib/node_modules/js-beautify/js/bin/html-beautify.js /usr/local/bin/js-beautify -> /usr/local/lib/node_modules/js-beautify/js/bin/js-beautify.js [email protected] /usr/local/lib/node_modules/js-beautify ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected])
@Uebyn Thank you for the reply.
web-beautify
use command line interface of js-beautify. It seems that something wrong with the command line interface of js-beautify from version 1.5.5. Could you try js-beautify 1.5.4?
FYI, see #23
@yasuyk Hi,
I've been getting the same issue and trying with js-beautify 1.5.4 didn't solve it.
Here's my information:
- OS: OS X El Capitan 10.11.6
- Node: 6.3.1
- Js-beautify: 1.6.4 (also tried 1.5.4)
Same here - 1.5.4 didn't solve it. On 1.5.4, once I change the format to this:
{ "js": { "indent_size": 2, "indent_char": " ", "eol": "\n", "indent_level": 0, "indent_with_tabs": false, "preserve_newlines": true, "max_preserve_newlines": 10, "jslint_happy": false, "space_after_anon_function": true, "brace_style": "collapse", "keep_array_indentation": false, "keep_function_indentation": false, "space_before_conditional": true, "break_chained_methods": false, "eval_code": false, "unescape_strings": false, "wrap_line_length": 0, "wrap_attributes": "auto", "wrap_attributes_indent_size": 4, "end_with_newline": true, "selector_separator_newline": true, "newline_between_rules": true } }
, js-beautify ignores my indent_size and defaults the indentation to 4 spaces instead.