I got a Laravel project, with TailwindCSS and I am trying to retrieve a piece of text from my database: "<div class="bg-red-500 text-green-200 text-lg border">Code should be here</div>
".
And I use Laravel Facade to retrieve it and got this in my view {!! $code !!}.
Now the issue is, the border seems to be applied, the larger text seems to work well, its just I cant set a background or text color, it just doesn't work.
What I am aiming to do, is that I can have a piece of frontend code including TailwindCSS stored in my database, and that I can basically 'pull' and store different code snippets to my database. (And also show the code working on my website)
What i already tried:
I already tried setting custom colors in my TailwindCSS config, but that did not fix the issue.
And I dont seem to be able to find a anwser on the internet either.
Tailwind's JIT only adds the styles that it sees in your blade files.
If either of the styles bg-red-500 text-green-200 text-lg border
is not present anywhere else, then they won't be available since Tailwind cannot infer that you need them simply by looking at the string {!! $code !!}
.