When we examine the source code of one of our Shopify stores, we see that there are too many line spaces and we want to remove it.
As far as I know, these spaces belong to liquid codes. Is there a way to remove blank lines?
I’ve tried Liquid filters but they don’t work. Like replace, strip.
And yes you can get fancy by capturing the entire html output in theme.liquid and parsing the spaces out but that isn’t a path I’d recommend unless you full control the codebase. It’s too easy for an error to be made if the code is a little inconsistent.
Out of interest, why does the space matter? It won’t be adding that much more data to download so if it’s for speed I would suspect there’s much bigger wins for you to look at first. You’d start getting into this kind of optimisation when you’re starting to run out of things to tweak.