You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When box-shadow has multiple values (separated by comma) it'd be prettier to put each value on a separate line #6024
When each value is on a separate line, the whole value feels significantly easier to read.
Reacted by Hawken Rives, Georgii Dolzhykov, Antonio Stoilkov, Chris Salzberg, Alex Collier, David Sveningsson, Alex, Ilán Vivanco, Alex Rice, Olof Fredriksson and 16 more
Reacted by Antonio Stoilkov, Daniel O’Connor, Alex Rice, Bluenix, Pavel Dronenko, Alex Sandiiarov and andywarrens
I would argue that these all look prettier with separate lines when they are separated with commas, particularly when there are more than 2 values.
I think such a rule will need some consideration for which CSS properties are enhanced by splitting across lines and which ones are not. font-family for example, looks worse when split:
I have a proof-of-concept PR that implements this here: #13260. It hard-codes specific properties to always wrap if they have more than one value. (Notably, I skipped font-family since as another commenter pointed out it doesn't look great wrapped.)
It seems like this might need some more discussion as to the preferred behavior - I've narrowed down the two primary decisions that would need to be made.
1. Always wrap lists
We can choose to always use the new wrapping behavior for lists with two or more elements, or only do it if the line would wrap anyways.
Orthogonal from the above, we can choose to apply this new wrapping behavior only for certain properties (like box-shadow, background-image, etc) while keeping the existing behavior for others (notably, font-family, but also transition-property). This makes sense if those properties often have many short elements, but makes the behavior inconsistent and possibly unexpected.
2.a - Only apply new wrapping to certain properties:
Activity
IlanVivanco commentedon Jan 28, 2021
I would love something like this!
ricealexander commentedon Jan 28, 2021
I agree with this.
box-shadowwith multiple values looks better with each value on a separate line.How about other properties like
background,background-image,text-shadow,@font-face#src?background-image (from Lea Verou Patterns)
text-shadow (from MDN docs)
font-face (from MDN docs)
I would argue that these all look prettier with separate lines when they are separated with commas, particularly when there are more than 2 values.
I think such a rule will need some consideration for which CSS properties are enhanced by splitting across lines and which ones are not.
font-familyfor example, looks worse when split:font-family
y0nd0 commentedon Mar 11, 2021
Could we implement this please as soon as possible. I think it's time to improve this ugly style behavior. It's one of the worst behavior in Prettier.
I prefer always multiline when multiple values.
Bad
Good
Airkro commentedon Jan 8, 2022
And variables:
From: https://github.com/stylelint-scss/stylelint-scss/blob/HEAD/src/rules/dollar-variable-colon-newline-after/README.md
Always wrap certain CSS prop values (box-shadow, text-shadow, etc)
Always wrap certain CSS prop values (box-shadow, text-shadow, etc)
sciyoshi commentedon Aug 8, 2022
I have a proof-of-concept PR that implements this here: #13260. It hard-codes specific properties to always wrap if they have more than one value. (Notably, I skipped font-family since as another commenter pointed out it doesn't look great wrapped.)
sciyoshi commentedon Aug 8, 2022
Note that since it looks at the property, it won't apply to SASS variables.
sciyoshi commentedon Aug 9, 2022
It seems like this might need some more discussion as to the preferred behavior - I've narrowed down the two primary decisions that would need to be made.
1. Always wrap lists
We can choose to always use the new wrapping behavior for lists with two or more elements, or only do it if the line would wrap anyways.
1.a - Always wrapping lists:
1.b - Only use new wrapping if line needs to wrap:
2. Only wrap certain properties
Orthogonal from the above, we can choose to apply this new wrapping behavior only for certain properties (like
box-shadow,background-image, etc) while keeping the existing behavior for others (notably,font-family, but alsotransition-property). This makes sense if those properties often have many short elements, but makes the behavior inconsistent and possibly unexpected.2.a - Only apply new wrapping to certain properties:
2.b - Apply new wrapping behavior to every property:
fisker commentedon Aug 9, 2022
Personally, I prefer "always".
fisker commentedon Aug 9, 2022
Another thing, where should we put
!important?sciyoshi commentedon Aug 9, 2022
Thanks @fisker - can you clarify here? You mean option 1.a and 2.b?
Right now (in the PR), it goes on the same line as the last item in the property list.
fisker commentedon Aug 11, 2022
1.a, only personal opinion, we need more discussion.
thorn0 commentedon Aug 16, 2022
How about "wrap if any list item contains more than 2 spaces"?
sciyoshi commentedon Aug 16, 2022
That could work as well as an alternative for #2 where it doesn't require special-casing the property names.
thorn0 commentedon Aug 29, 2022
Let's do it (#6024 (comment)) then, shall we?