How to use CSS Variables with Ruby on Rails Discussion
Discussion for
How to use CSS Variables with Ruby on Rails
I asked a question on discord and thought it might be good for it to be here for future reference.
https://discord.com/channels/874684608686477352/874684609164640358/958015390347329658
Question:
I was wondering of a way to dynamically change which class you are calling. ie:
'<%= "text-#{color} bg-#{color}" %>' << this code is not recommended since tailwind needs the full class name to build.
Answer(chris):
you can supply a custom color to Tailwind in the config
module.exports = {
colors: {
'primary': 'var(--primary-color)',
same thing as a regular color there