g-plane / malva

Configurable, smart and fast CSS, SCSS, Sass and Less formatter with dprint integration.
https://dprint.dev/plugins/malva
MIT License
78 stars 3 forks source link

support postcss #9

Closed clouds56 closed 3 months ago

clouds56 commented 6 months ago

I'm using postcss which would process @apply and --at-apply, and following code failed to format. note there's . in value.

.text {
  @apply: px-2.5 py-1.5;
}

.text {
  --at-apply: px-2.5 py-1.5;
}

Error formatting test.css. Message: Formatting not stable. Bailed after 5 tries. This indicates a bug in the plugin where it formats the file differently each time.

g-plane commented 6 months ago

Your code has invalid syntaxes: the dot . must be escaped like this: px-2\.5.

clouds56 commented 6 months ago

It could be escaped, but not "must". When I write px-2.5, it applies correctly, and my highlight plugin could recognize it. When I write px-2\.5, it works, but highlight plugin doesn't recognize it.

g-plane commented 6 months ago

. (without escaping) isn't an valid character of identifier, so actually there're two tokens: px-2 and .5.