You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically, I used to extend the env class and add a new variable to keep tracking all the rendered templates to use the list later for CSS purge (Removing unused CSS). but without base_template_class option on the V3 I cannot do that anymore because I cannot use the custom template to call the tracking function I've prepared in the Environment class.
What I can do to preserve the similar behavior I have done in the custom template classes.
Sorry if it's not the right channel.
The text was updated successfully, but these errors were encountered:
You can use a node visitor to inject custom nodes adding logic at the beginning or the end of the rendering of a template. See the ProfilerExtension for an example.
This solution is strictly superior to changing the base class (as multiple extensions can use this extension point at the same time, while we cannot have multiple base classes). And it also works in Twig 1 and 2.
I've posted the question here but no answer yet.
https://stackoverflow.com/questions/72513154/alternative-of-base-template-class-php-twig-template
Basically, I used to extend the env class and add a new variable to keep tracking all the rendered templates to use the list later for CSS purge (Removing unused CSS). but without
base_template_class
option on the V3 I cannot do that anymore because I cannot use the custom template to call the tracking function I've prepared in the Environment class.What I can do to preserve the similar behavior I have done in the custom template classes.
Sorry if it's not the right channel.
The text was updated successfully, but these errors were encountered: