You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passed a color name, it generates a string of class names which can be appended to the class list for a button. If given the color "blue", it will generate the following string: bg-transparent text-blue-500 border-blue-500 hover:bg-blue-500 hover:text-white.
If the classes text-blue-500 border-blue-500 hover:bg-blue-500 are not used elsewhere in the project, the purger will remove them since they have not been explicitly specified.
As a quick hack for getting around this, I defined a constant like this:
Since I'm explicitly specifying the color classes per color, the purger keep the classes; I just need to repeat for each of the colors that I want to provide styles for.
But it seems like setting class names dynamically might be something that would make sense to want to do in certain instances. It feels like something that would be fairly natural to do.
What are your thoughts? Which of the two workarounds listed above makes the most sense in your opinion? Thanks for your time.
The text was updated successfully, but these errors were encountered:
Consider the following example function:
When passed a color name, it generates a string of class names which can be appended to the class list for a button. If given the color "blue", it will generate the following string:
bg-transparent text-blue-500 border-blue-500 hover:bg-blue-500 hover:text-white
.If the classes
text-blue-500 border-blue-500 hover:bg-blue-500
are not used elsewhere in the project, the purger will remove them since they have not been explicitly specified.As a quick hack for getting around this, I defined a constant like this:
While this is obviously not ideal, it works since it allows the purger to read those values and thus not purge them.
I could refactor the
style_for_btn_outline
method to something like this:Since I'm explicitly specifying the color classes per color, the purger keep the classes; I just need to repeat for each of the colors that I want to provide styles for.
But it seems like setting class names dynamically might be something that would make sense to want to do in certain instances. It feels like something that would be fairly natural to do.
What are your thoughts? Which of the two workarounds listed above makes the most sense in your opinion? Thanks for your time.
The text was updated successfully, but these errors were encountered: