Reputation: 671
How to apply Tailwind CSS styles to the HTML response from API on runtime?
I have a project in which I requested an API that gave me an HTML response.
<div class="bg-blue-900">Test</div>
Now, since I didn't use the bg-blue-900
class before in my project, bg-blue-900
CSS styles didn't get generated. How do I apply Tailwind CSS styles to the HTML response from API on runtime?
Upvotes: 1
Views: 755
Reputation: 21
You can add it to the safelist in the tailwind config.
safelist: [
'bg-blue-900',
or for all bg colors ...
{
pattern: /^bg-/,
},
]
Upvotes: 2