Hello,
I wanted to know if i could use twig in a .css file?
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!
Log in to reply.
| Topic | Participants | Replies | Views | Activity |
|---|---|---|---|---|
| 0 | 1362 | 9 years ago | ||
| 2 | 940 | 9 years ago | ||
| 2 | 4069 | 9 years ago | ||
| 1 | 2960 | 9 years ago | ||
| 3 | 1124 | 9 years ago |