Extension, Plugin

Archived
Forum
(read-only)

Minimee

ExpressionEngine 2

Back to this add-on's main page
View Other Add-ons From John D. Wells

     

“minify html” is only working with extension installed not with config via config.php only

Bug Report

ballmann
ballmann

we use this wonderful plugin with several websites but with our most recent project we tried optimizing every little bit. and so i tried to use minify without the extension installed as the docs say (for best performance).

but we noticed yesterday that the “minify html”-option only works with the extension enabled. if you use the configs via config.php alone no html will be minifyed. so the following code has no effect on the html:

/**
     * Turn on or off minifying of the template HTML.
     * Values: 'yes' or 'no'
     * Default: no
     */
    
'minify_html'       => 'yes'

we use 2.1.13 of minimee and ee 2.10.1.
any ideas?

we use this wonderful plugin with several websites but with our most recent project we tried optimizing every little bit. and so i tried to use minify without the extension installed as the docs say (for best performance).

but we noticed yesterday that the “minify html”-option only works with the extension enabled. if you use the configs via config.php alone no html will be minifyed. so the following code has no effect on the html:

/**
     * Turn on or off minifying of the template HTML.
     * Values: 'yes' or 'no'
     * Default: no
     */
    
'minify_html'       => 'yes'

we use 2.1.13 of minimee and ee 2.10.1.
any ideas?

John D Wells
# 1
Developer
John D Wells

Hey ballmann,

Sorry for the slow reply, I was gone for a long weekend…

If I recall, with the extension disabled you just need to “tell” EE’s template parser to let Minimee do it’s thing on the parsed HTML - so if you add this anywhere in your rendered template (in a layout if you’re using it):

{exp:minimee:html}

That should be enough to kick it into gear.

Want to give that a try and let me know if it works?

Cheers,
John

p.s. Are you using CE Cache?

Amity Web
# 2
Amity Web

We’re having this issue, dont know if its related or not but thought I’d keep the same thread just in case.

The strange issue with us is on first page load HTML is minified, but then on reload its not minified anymore. We are using template caching (not CE cache). So thats why its strange, on first page load it should cache the code, but second page load shows unminified. This is after we clear the cache of course. Happens everytime after we clear the cache, load the page (minified) then refresh (unminified).

I tried adding the above code {exp:minimee:html} to our main layout file so would be on all templates but didnt work.

Note: in the docs it says to disable it. Do does that mean enable it in the EE extensions list, and then disable it in the Minimee config (“Disable Minimee entirely?”) which works, OR does it mean disable it in the EE Extensions list (which does not work).

Thanks

John D Wells
# 3
Developer
John D Wells

Hi Amity,

Can you let me know what version of Minimee & EE you’re running?  I’m not seeing what you describe on a 2.x version of EE, so I want to be sure I can test an accurate setup to yours.

Cheers,
John

Amity Web
# 4
Amity Web

Its 2.1.13, but it was also occurring on I think 2.1.10, I upgraded to see if it fixed it but it didn’t.

EE version 2.9.0

Have you got template caching on? I have seen this issue on other sites for quote some time (only reporting it now though) and I have a hunch it happens when we cache the templates, but cant be sure.

John D Wells
# 5
Developer
John D Wells

Hi Amity,

Minimee attempts to minify HTML at the template_post_parse hook provided by EE, which happens after EE saves a template in the cache.  You can verify this by clearing EE’s cache, and then hit a page once and then look in system/expressionengione/cache/page_cache/, there will be a folder with a hash name and then inside that a file; it should contain the (mostly) processed response from EE, and the HTML will NOT be minified.

However, Minimee still is “allowed” to run on the template_post_parse hook, even for templates that have been cached, which it should do whether or not the extension is installed or not.

If you turn on EE’s template debugging, Minimee outputs logging messages at every major step of execution - every message starts with one of:

"Minimee [INFO]..."
"Minimee [ERROR]..."
"Minimee [DEBUG]..." 

At the stage of HTML minification, the message will either be:

"Minimee [INFO]: Running HTML minification."
"Minimee [INFO]: HTML minification is disabled." 

So if you can turn on the debugging, and hit your page on both cold & warm cache states, see what Minimee is reporting that it’s trying to do - Minimee actually does throw a few other logging messages that are related to the processing flow around HTML minification, so it might be best to search for every instance of “Minimee [” in the debugging output.

If there is no mention either way of MInimee running HTML minification, then it’s likely a hook conflict - see if any other plugins operate on that same template_post_parse hook.

Cheers,
John

p.s. If you have the handy extension EE Debug Toolbar installed, then when debugging is on Minimee will add it’s own panel to the debug toolbar with only it’s log messages isolated.