unocss / unocss

The instant on-demand atomic CSS engine.

Home Page:https://unocss.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

css formater brokes @apply

kleinpetr opened this issue · comments

Hi guys,

what settings do you use in vscode to format your code (Vue3+TS)? Because The default formatting drives me crazy when it comes to
css @apply directives such as

image

any suggestions? Thanks :)

Great!

-> Can we have better errors when the engine cannot find the directive?

Example:

This works:

@apply bg-gray-200;

This throws a complicated error:

@apply dark:bg-gray-200;

This is the error:

[vite] Internal server error: Cannot read properties of undefined (reading 'forEach')
  Plugin: unocss:transformers:default

I migrated a CSS file from an old vitesse to the current version (great library, btw). It took me 20 minutes to arrive here and understand what is happening.

Thanks for your ultra-great work!

cool, but it is not work for some reason 🤔 I've solved it by create a custom rules, I prefer to use attributiffy mode instead of class=".." so with rules the html looks bit more clear. But keeping in mind and will try it in the future. thanks

I believe this is more related to the formatter you use rather than something we could do on our side.

ok, didn't know that. I was searching in https://uno.antfu.me/?s=grid-cols
Thanks for clarify.