question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CSS comments always put on new line.

See original GitHub issue

Broken again in latest:

>npm install js-beautify
+ js-beautify@1.10.0
added 28 packages from 21 contributors and audited 125 packages in 1.954s
found 0 vulnerabilities

>echo h1{color:red;/*comment*/} > test.css

>js-beautify -f test.css
h1 {
  color: red;
  /*comment*/
}
>type .jsbeautifyrc
{
        "brace_style": "collapse,preserve-inline",
        "break_chained_methods": false,
        "eval_code": false,
        "extra_liners": [],
        "indent_char": " ",
        "indent_level": 0,
        "indent_size": 2,
        "indent_with_tabs": false,
        "jslint_happy": true,
        "keep_array_indentation": false,
        "keep_function_indentation": false,
        "max_preserve_newlines": 3,
        "newline_between_rules": false,
        "preserve_newlines": true,
        "space_before_conditional": true,
        "unescape_strings": false,
        "wrap_line_length": 0
}

css.replace(/;\n\s*\/\*/gs, '; /*') should fix that.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
bitwisemancommented, May 21, 2019

Thanks! This has been the expected behavior at least back to 1.7.5, so not a break.
However keeping single line comments on the same line is a reasonable enhancement.

0reactions
eifrcommented, Jan 24, 2021

still happening… It would be very helpful to have comments in-line

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to line-break from css, without using <br />?
Consider a list of <a> links on a vertical menu where you want them all on their own line, but can't use <br>...
Read more >
Comments in CSS - CSS-Tricks
Everything enclosed between /* and */ is treated as a comment regardless of how many lines they span, so any other apparent “syntax”...
Read more >
How to Add Comments in CSS for Yourself or Your Developer
To comment in CSS, simply place your plain text inside /* */ marks. This tells the browser that they are notes and should...
Read more >
CSS Comments - W3Schools
Comments are used to explain the code, and may help when you edit the source code at a later date. Comments are ignored...
Read more >
How To Prevent Line Breaks Using CSS - DigitalOcean
In this tutorial prevent line breaks using CSS's white-space property. You will achieve this using three different configurations.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found