• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Best hook for html compressor

Marcus

Well-known member
#1
What is the best hook for implementing a html / css compressor (removing white spaces etc, not gzip)? Is it the view or is there some other class in xf2?
 

Chris D

XenForo developer
Staff member
#2
Probably the templater_template_post_render code event with an event hint of public:PAGE_CONTAINER.

That will contain the final output of the page so you can modify it before it is returned.
 

Kirby

Well-known member
#4
Probably the templater_template_post_render code event with an event hint of public:PAGE_CONTAINER.

That will contain the final output of the page so you can modify it before it is returned.
Hmm ... this does not seem to be entirely correct, JS and CSS seems to be missing there (it does get added by \XF\Mvc\Renderer\Html).

I'd go for app_final_output
 

Chris D

XenForo developer
Staff member
#5
I missed the mention of CSS in the first post (no mention of JS either). Indeed that would likely be better to minify everything. At that point you can modify the entire response body.