js-beautify icon indicating copy to clipboard operation
js-beautify copied to clipboard

Add option to add space between CSS selectors

Open bibekoli opened this issue 4 years ago • 4 comments

Description

This is the default template for feature requests. I don't see any option to set space between the CSS selectors like: No space: a,p,b{} Yes space: a, p, b{} So, it'll be awesome if you add this feature too.

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

With this new feature, when I give like this input:

#main,#section, a {
  color: blue;
}

Expected Output

I'd like to see this output:

/*When the option is true*/
#main, #section, a {
  color: blue;
}
/*When the option is false*/
#main,#section,a {
  color: blue;
}

Environment

OS: Android => Chrome

bibekoli avatar Dec 07 '20 04:12 bibekoli

@BibekOli Have you tried space_around_combinator? Please reopen if that does not work.

bitwiseman avatar Dec 10 '20 18:12 bitwiseman

No, space_around_combinator doesn't work in putting/ removing spaces after ',' comma. It only work with 3 combinator i.e. + > ~

Here, I gave this code to beautify: p,b,a>b{color:red}

When space around combinator is "false" p, b, a>b { color: red; }

When space around combinator is 'true' p, b, a > b { color: red; } It doesn't control the space after comma.

bibekoli avatar Dec 11 '20 03:12 bibekoli

Hi, it doesn't look like this is in development yet so I've begun working on this assuming it is still an enhancement of interest. I'll keep everyone updated on my progress. Thanks.

kcamsanc avatar Mar 24 '22 00:03 kcamsanc

Hi, I just opened a PR #2029 for my first attempt at implementing this option. Let me know what you think.

kcamsanc avatar Apr 10 '22 22:04 kcamsanc