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

[Prettier CSS] Multi-line comma separated selectors #1962

Closed
TheSisb opened this issue Jun 4, 2017 · 6 comments
Closed

[Prettier CSS] Multi-line comma separated selectors #1962

TheSisb opened this issue Jun 4, 2017 · 6 comments
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Comments

@TheSisb
Copy link

TheSisb commented Jun 4, 2017

I think in terms of legibility, multi-lining comma separated selectors is much more readable. Could this be the default?

Example of desired effect:

.ball, 
.rabbit,
.wrapper:hover .contents,
.wrapper:active .contents {
  color: red;
}

What prettier currently emits:

.ball, .rabbit, .wrapper:hover .contents, .wrapper:active .contents {
  color: red;
}

The single line approach usually ends up creating really long lines that require horizontal scrolling and break n characters per line conventions (usually 80 or 120).

@jitendravyas
Copy link

It also does this too.
monosnap 2017-06-05 16-42-38

@giuseppeg
Copy link

giuseppeg commented Jun 6, 2017

Agreed, this style kinda makes it uglier :)

Maybe you can borrow the formatting guidelines from Nicolas' Ideomatic CSS. Properties sorted alphabetically because it is probably the only universal criteria (although I prefer Nicolas' version).

@azz azz added the lang:css/scss/less Issues affecting CSS, Less or SCSS label Jun 6, 2017
@jitendravyas
Copy link

Any solution for this?

@yuchi
Copy link
Contributor

yuchi commented Jun 7, 2017

I’m making a pull request for this just now.

yuchi added a commit to yuchi/prettier that referenced this issue Jun 7, 2017
Changes the behaviour for line breaking inside selector lists (those
separated by ',') so that every selector is in its own line.

Can be changed back to previous behaviour setting the option
'cssSelectorListSameLine' to 'true'.

In the CLI is '--css-selector-list-same-line'.

Fixes prettier#1962
yuchi added a commit to yuchi/prettier that referenced this issue Jun 8, 2017
Changes the behaviour for line breaking inside selector lists (those
separated by ',') so that every selector is in its own line.

Fixes prettier#1962
vjeux pushed a commit that referenced this issue Jun 8, 2017
Changes the behaviour for line breaking inside selector lists (those
separated by ',') so that every selector is in its own line.

Fixes #1962
@jitendravyas
Copy link

@yuchi will it solve this too?
#1962 (comment)

@vjeux
Copy link
Contributor

vjeux commented Jun 8, 2017

@jitendravyas no, this will not change with his PR. Could you open a separate issue for it?

@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 7, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lang:css/scss/less Issues affecting CSS, Less or SCSS locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.
Projects
None yet
Development

No branches or pull requests

6 participants