Closed
Description
We need to do something about the amount of generated whitespace in rendered Liquid templates. We have several issues and pull requests about that right now (#215, #214, #194, #171, #162) and no suitable fix.
I want to open this for discussion because it's not only annoying for third-party users but also considerably slowing down a lot of Shopify storefronts because of megabytes of whitespace resulting from big nested loops.
A few ideas have shown up:
- Add Erb like tags (this slows down parsing a lot, as can be seen in Add ERB-like trim mode for tags and outputs #214).
- Automatically collapse all white-space (this will break stuff where whitespace is intended, email templates for instance).
- Create a filter for collapsing white space which can manually be wrapped around loops (not sure if this will make things much faster, but at least the output will be smaller - on the other hand, it has to be done by hand for each template).
- Automatically collapse whitespace in loops if (and only if) the rendered output contains only whitespace (this will catch some of our worst-cases, but won't fix the problem entirely).
- ...
Comments?
@boourns @hornairs @csfrancis @dylanahsmith @camilo @arthurnn
cc @jcrawford @nickpearson @avalanche123 @ragalie
Activity