Skip to content
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

[Bug] - No space between rule and !important when used inside of @apply directive #25

Open
AndrewBogdanovTSS opened this issue Feb 12, 2021 · 0 comments

Comments

@AndrewBogdanovTSS
Copy link

AndrewBogdanovTSS commented Feb 12, 2021

After I've upgraded to v. 1.5.0 sorting of properties begin to work in my .vue files style section which is good, but when I use !important inside of @apply rule prettier strip out a space between rule and !important which leads to compile errors. E.g.:

&:hover,
        &--highlighted {
          @apply border-orange  border !important;
        }

is formatted into:

&:hover,
        &--highlighted {
          @apply border-orange  border!important;
        }

logically tailwind tries to treat it as a utility and throws this error:

 `@apply` cannot be used with `.border\!important` because `.border\!impor
tant` either cannot be found, or its actual definition includes a pseudo-selector
 like :hover, :active, etc.

Temp workaround for anyone suffering from this issue, you can use prettier ignore comment to disable prettyfication:

&:hover,
        &--highlighted {
           /* prettier-ignore */
          @apply border-orange  border !important;
        }

or if you use 'postcss-comment' parser (like I do):

&:hover,
        &--highlighted {
          // prettier-ignore
          @apply border-orange  border !important;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant