Closed Mottie closed 8 years ago
Looks like an issue with resetting decl.between
. Thanks for reporting.
Released as 1.2.1
.
Thanks for the fix!
Still one minor issue though. If I include a comment before the selectors, it adds an extra carriage return now:
Starting with:
/* comment 0 */
.selector {
/* comment 1 */
color: /*[[placeholder]]*/ white;
/* comment 2 */
}
the result becomes:
/* comment 0 */
.selector {/* comment 1 */
color: /*[[placeholder]]*/ white; /* comment 2 */
}
Any way to get the first comment directly above the selector, and the second comment back on it's own line? :grin:
This might need a bit more thought. For example if we have some CSS like this:
h1 {
color: black; /* Don't change this line! */
}
The formatter would then break the semantics of the comment. I wonder if there is some way to tell if both the property value pair & the comment are on the same line.
In terms of block formatting comments, there are different opinions on that and we could look into providing options for that. See https://github.com/ben-eb/perfectionist/issues/4 also.
I got a little lost trying to read through the code, so I don't know how much help I could be with troubleshooting. I guess it's not a huge deal if the comment ends up on the next line, given you are trying to support different levels of formatting.
Adding an option for comment formatting would be awesome! :cake:
We use our styles at userstyles.org, so some css definitions have placeholder comments within the definition (see "placeholder" in the example below) which get replaced with user set choices:
With default settings, the result removes the essential placeholder comment: