Liquid (and module rendering) inside other text based files such as .css, .js, .xml, .json, .txt, etc.
Add “.liquid” suffix to the file URL to force it to be processed by the liquid engine.
Example
File:
/assets/css/main.css
In order to parse file by liquid first use such link:
/assets/css/main.css.liquid
@Peter-Schmidt Can you please attach this forum post to this backlog item https://portal.treepl.co/backlog/2092
I think it would be worth having some additional conversation around this feature. I think it could be really powerful.
@Adam.Wilson I recall that you generated this idea originally.
@TimL I think that it was mentioned that this functionality could address a JSON use case.
I would love to see anybody else’s input on what the possibilities with this feature could be. I mean it really opens up some interesting possibilities.
It’s pretty interesting to think about dynamically influencing .css with liquid logic. You could make changes based on the context in which CSS is called. The idea of mixing liquid and js in an external js file is pretty interesting. You could theoretically call a module in a .js file, pull in values and pass them to the JS. It’s pretty wild west.
I’m trying to think of some specific use cases. If somebody can come up with some I’d be interested to hear them.