Can an app parse liquid before it is rendered?

Shopify Partner
5 0 0

Hello everyone, I'm currently working on a pure AMP theme for Shopify and there is a tool call the amp optimizer in node.

What it does is basically parsing your html, making sure you require all the amp scripts, optimizing images, replacing some markups with amp markups, etc...

I'm not very famillar with the Shopify apps possibilities yet and before I dive deep into this, I'd like to know if it is actually possible to run a liquid file through a parser before it is rendered (So running the amp optimizer)?

If it is, what would be the approch to do it?

Thank you