I'm building an app in Laravel where I use Vue.js as the frontend and Laravel as the backend. For the frontend I also use tailwindcss. So here's what's going on:
- You visit a route
- Vue will request the data from the api for that route
- Data gets set to be loaded in the frontend
The requested data returns an array of multiple objects. Each object has got a color
variable inside which I want to use to set the color of a text, but while this is happening the tailwindcss is already been build so the colors won't generate. Another problem is that you'll never know what color you need so setting some random values in the tailwind.config.js
won't work.
Here is my Vue.js part where I want to load the color:
<div v-for="item in packages.data">
<h2 class="text-2xl" :class="'text-['+item.color+']'">
{{ item.name }}
</h2>
</div>
I also use scss in my project if it isn't possible using tailwind.
If additional code is needed just let me know.
Any help would be appreciated!