tailwindcss icon indicating copy to clipboard operation
tailwindcss copied to clipboard

[FEATURE] CSS variables

Open florenthobein opened this issue 8 years ago • 4 comments

Did you already consider including the JS config variables in the generated lib, as css variables?

In my projects, I include the generated output of a configured tailwind as a css library, then extend it with targeted css, and I'd love to be able to make use of, say, colors as css variables.

Ex:

In Tailwind config:

let colors = {
  ...
  'black': '#22292f',
  ...
}

would generate in the css:

:root {
  --color-black: #22292f;
}

florenthobein avatar Feb 28 '18 14:02 florenthobein

See https://github.com/tailwindcss/tailwindcss/issues/260

At the current time it makes more sense to define the variables you'd like in your CSS.

SmashBrando avatar Feb 28 '18 17:02 SmashBrando

Alright, so, the other way around. Thanks.

florenthobein avatar Feb 28 '18 17:02 florenthobein

Yeah like mentioned in the other issue we don't have concrete plans to implement anything like this, but it could totally be done with another PostCSS plugin or even Tailwind's upcoming plugin system.

adamwathan avatar Mar 01 '18 17:03 adamwathan

I made it as plugin https://github.com/omarkhatibco/tailwind-css-variables

omarkhatibgg avatar Sep 26 '18 11:09 omarkhatibgg