Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Liquid in Rails assets

I'm using Liquid in my CSS. For example, I have test.css.liquid which contains:

body { background: {{ 'red' }}; }

When I run rake assets:precompile, it's not test.css that's compiled but still test.css.liquid and the Liquid code isn't parsed.

Sprockets uses Tilt which has a Liquid parser by default. I have Liquid enabled on my site.

Any idea what could be wrong?

like image 973
ben Avatar asked Nov 13 '22 11:11

ben


1 Answers

It is bad idea to rename the manifest file application.css. You can include assets by requiring it in the manifest file , like this :

*= require your_styles

and in case you've initiated the liquid engine , it should be OK.

like image 126
R Milushev Avatar answered Dec 30 '22 03:12

R Milushev