Skip to content

Help with unused CSS messages #2104

Closed Answered by endigo9740
MrAmericanMike asked this question in Q&A
Discussion options

You must be logged in to vote

I'm having issues when using PostCSS and @apply instead of writing the classes on the html itself.

Just so we're on the same page here, this is considered and anti-pattern of Tailwind. Utility classes are meant to be inserted directly into your template, even if you don't find it as compact or pretty as you might want. This is how they are designed to work. Abstracting with @apply is a practice that even Tailwind themselves discourage:

https://tailwindcss.com/docs/reusing-styles#avoiding-premature-abstraction

The other issue you might running into here is that doing this in a <style> tag within a route/component doesn't always work as you might expect. Scope is isolated when it comes to…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MrAmericanMike
Comment options

Answer selected by MrAmericanMike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants