Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typical format for .jsbeautifyrc is ignored. #24

Open
ghost opened this issue Oct 5, 2016 · 5 comments
Open

Typical format for .jsbeautifyrc is ignored. #24

ghost opened this issue Oct 5, 2016 · 5 comments

Comments

@ghost
Copy link

ghost commented Oct 5, 2016

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.

@ghost ghost closed this as completed Nov 5, 2016
@yasuyk
Copy link
Owner

yasuyk commented Nov 5, 2016

@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

@ghost
Copy link
Author

ghost commented Nov 10, 2016

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])

@yasuyk
Copy link
Owner

yasuyk commented Nov 13, 2016

@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 yasuyk reopened this Nov 13, 2016
@neocryses
Copy link

@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)

@ghost
Copy link
Author

ghost commented Nov 19, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants