Adding Twig in a css

Hello,

I wanted to know if i could use twig in a .css file?

No that’s not possible. CSS files are loaded directly by the browser and must be valid CSS only. You can however use a CSS pre processor like SASS/LESS etc. This way you can create CSS with variables.

Is there no way to configure twig to compile custom.css.twig? I’m trying to build a customizable theme that allows you to set theme colors in the configuration, and the best way would be to spit out the color vars into a custom css file — otherwise I’ll have to inline style the whole thing.

Twig cannot do that, but you can do it with SCSSPHP - https://github.com/leafo/scssphp

Right on, thanks rhukster!