-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Preserve empty line between CSS blocks #2621
Comments
Somewhat related: #2068 |
Nope not working for SCSS but works for JS... Wildcard just to see if it'll work but not at all
|
Bump. We'd like to use Prettier on our SCSS but can't until this issue is resolved :-( |
@nelsieborja and @gvincentlh Can you clarify if you want empty lines in the input code to be preserved (like in JS → will likely be fixed, or already works, not sure atm), or if you want to enforce blank lines at specific places (unlikely to happen)? |
@lydell we would need the ability to enforce (via config switch?) blank lines between selectors. |
Here is a clarification of the current state: Currently, handling of blank lines works the same for CSS as in JS. In JS, Prettier never prints blank lines on its own. It only preserves blank lines from the input JS (with some extra rules). This is because finding where to place blank lines in JS is hard, and allowing the user to choose where they should be is a trade-off that had to be made to make Prettier usable in practice. So, currently, the same applies to CSS.
|
Has this been resolved? Is there currently a work around? |
@cmseaton42 No, this is not resolved. Workaround: Use stylelint. |
Closing. Should be done with |
New options were recently added to the The following configuration makes use of these new options, and I believe it will configure stylelint to avoid stepping on Prettier's toes: {
"rules": {
"at-rule-empty-line-before": [
"always",
{
"except": ["blockless-after-same-name-blockless"],
"ignore": ["after-comment", "first-nested"],
"severity": "warning"
}
],
"custom-property-empty-line-before": [
"always",
{
"except": ["after-custom-property"],
"ignore": ["after-comment", "first-nested", "inside-single-line-block"],
"severity": "warning"
}
],
"declaration-empty-line-before": [
"always",
{
"except": ["after-declaration"],
"ignore": ["after-comment", "first-nested", "inside-single-line-block"],
"severity": "warning"
}
],
"rule-empty-line-before": [
"always",
{
"ignore": ["after-comment", "first-nested"],
"severity": "warning"
}
]
}
} You'll need at least |
For readability purpose, I want to enforce space between CSS blocks like so:
Does this already exist? I can't seem to find its availability in your rules..
The text was updated successfully, but these errors were encountered: