css-beautify inserts extra newlines before comments
See original GitHub issueDescription
This is the default template for bug reports, if you have a more general issue, question, or request, you may ignore this template and write freeform.
NOTE:
- Do not include screenshots! This library is a text processor, we need text inputs and outputs for debugging and fixing issues.
- Check the list of open issues before filing a new issue.
Input
The code looked like this before beautification:
html {}
/* comment */
Expected Output
The code should have looked like this after beautification:
html {}
/* comment */
Actual Output
The code actually looked like this after beautification:
html {}
/* comment */
Steps to Reproduce
Environment
OS: Debian 8 Jessie
Settings
Example:
{
"indent_size": 4,
"indent_char": " ",
"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,preserve-inline",
"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
}
I would expect that css-beautify puts a fixed number of newlines before the comment. Instead, by running
css-beautify -f file.css -r
repeatedly, there’s an increasing number of newlines before the comment.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:8 (4 by maintainers)
Top Results From Across the Web
Prevent js-beautify from adding extra whitespace / empty lines
a fancy comment */ <-- annoying empty line inserted .foo-bars { background: $gray; display: block; <--- (this is fine.
Read more >js-beautify - UNPKG
329, * Extra newline is inserted after the comment line instead of before it ([#531](https://github.com/beautify-web/js-beautify/issues/531)).
Read more >website/node_modules/js-beautify/CHANGELOG.md - Rdrr.io
Incorrect indentation after loop with comment (#1090); Extra newline is inserted after beautifying code with anonymous function (#1085); end brace with next ...
Read more >js-beautify-ejsx | Yarn - Package Manager
Incorrect indentation after loop with comment (#1090) · Extra newline is inserted after beautifying code with anonymous function (#1085) · end brace with...
Read more >JS-Beautifier/CHANGELOG and JS-Beautifier Releases (Page 5 ...
Fixed a batch of comment and semicolon-less code bugs. Closed Issues. Incorrect indentation after loop with comment (#1090); Extra newline is inserted ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It keeps adding new line between css rule and comments
I try format vue file in vscode. The code is
border: 1px solid #ddd;/*no*/
for ignore px2rem, but after format code, The code becomes:it add new line before /no/ comment and it will not work for ignore px2rem.
help me.