Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter $output after render and before it is cached #2908

Closed
jl-a opened this issue Jan 30, 2024 · 1 comment
Closed

Filter $output after render and before it is cached #2908

jl-a opened this issue Jan 30, 2024 · 1 comment

Comments

@jl-a
Copy link
Contributor

jl-a commented Jan 30, 2024

I use the timber/output filter to modify output after it has been rendered. I can see that this filter is applied to Timber's output after the output has been cached. Therefore the filter will be run every time, regardless if the original output is cached or not.

This is great for filters that dynamically change content; however for deterministic filters it's a bit inefficient. In my specific case I use timber/output with a HTML minification library to clean up whitespace; obviously if the un-minified output is already being cached it seems inefficient to not also cache the minified render.

Could an additional filter for $output be added immediately after the template is rendered, and before the cache is set? Perhaps something like timber/output/pre-cache

@Levdbas
Copy link
Member

Levdbas commented Jan 30, 2024

Hi @jl-a , thank you for your issue and welcome at Timber. Please fill in the full issue report next time so we know what we're working with. But in this case you seem pretty sure where a changes has to be made. Would you like to create a Pull Request to add this filter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants