-
Notifications
You must be signed in to change notification settings - Fork 187
why adding @apply to .field_with_errors doesnt work? #191
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
Comments
Thank you for the issue. tailwindcss-rails is mostly a wrapper around the tailwindcss command line tool. All the behavior is defined by tailwindcss, so if something isn't working with your css, it is likely it is a tailwindcss issue. So it is better to report to tailwindcss. |
@buncis I ran into something similar and used the module.exports = {
safelist: [
'field_with_errors'
]
} |
because the and tailwind css doing tree-shaking when compiling, it will try to remove all custom css that is not used therefore to make it stay we could declare the class without using @layer as per this guide the final correct syntax are @tailwind base;
@tailwind components;
@tailwind utilities;
.field_with_errors {
@apply flex w-full
} |
@iamjohnford I also found another solution that is applying the code outside layer its because the guide say safelist is less favoured to use https://tailwindcss.com/docs/content-configuration#safelisting-classes thanks for you for mentioning me with ur solution that I could finally found a solution |
@buncis Nice. Thanks for the info! What you mentioned above works for me as well. |
Uh oh!
There was an error while loading. Please reload this page.
I got this warning in my inspect element

application.tailwind.css
it works normally when the class is added from the start
but when its added by a form that has error its not work
ref active_record_validations#displaying-validation-errors-in-views
I'm also using turbo and it seems work normally without turbo
my current solution to this is I'm adding empty div with the class
I kinda got confused too sometimes it works sometimes its not
The text was updated successfully, but these errors were encountered: