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

     

HTML minification

General

Tyssen
Tyssen

You mention on the home page for the plugin on your site that 1.4 now supports HTML minification but I can’t find any documentation relating to that. Could you give me some pointers about how to do it?

John D Wells
# 1
Developer
John D Wells

Hi Tyssen,

Sorry that I haven’t updated the docs for that yet!  But there are 2 ways to do it:

Option 1: if you have the Minimee Extension installed, it’s now available as a setting

Option 2: If configure via bootstrap (config or global vars), it’s “minimee_minify_html” that you set to “y” or “yes”.

It should be noted that this does not *cache* the HTML output, it merely runs the minification prior to output.  But if you use something like CE Cache, it should play nice.  Also note you’ll need EE2.4 to have this feature.

Do let me know if you have any issues or ideas - it was a quick update along with the 2.4 release.

Best,
John

Tyssen
# 2
Tyssen

Thanks, just tried it out with bootstrap and it seems to work fine. The source sure does look funny like that though, lol.

John D Wells
# 3
Developer
John D Wells

I know, totally looks wonky!

If you ever notice any issues with performance etc, let me know.  This feature is a rather significant departure from the spirit of Minimee (since it does not cache), but I just couldn’t resist, been wanting to minify HTML for ages…  Plus I do think since there are things like CE Cache that are out there, they can be a powerful combo…

Cheers,
John

Ryan Masuga
# 4
Ryan Masuga

I just tried minifying HTML via the config file, and the HTML wasn’t being compressed. After installing the Extension, I got the note in the CP that the extension wasn’t necessary because my settings were in the config file, and viewing source showed that the output was being compressed. It appears the extension needs to be installed for the HTML compression to work correctly, or at all?

John D Wells
# 5
Developer
John D Wells

Hi Ryan,

Hmm, it should be able to work without the extension being installed - granted I basically inject Minimee manually into the hook array, but has appeared to work thus far…

Are you using Minimee at least once to act upon your CSS or JS?  Because that could be the rub - when the extension isn’t installed, Minimee needs to run at least once to place itself in the hook stream.

If you only want Minimee to run your html, this undocumented tag will wake the beast up:

{exp:minimee:html}

Place that anywhere in a template, and you should be good to go.

Let me know though if that isn’t the case, and you are using Minimee elsewhere, so I can investigate further.

Cheers,
John

Ryan Masuga
# 6
Ryan Masuga

I’ll bet that’s it. I hadn’t used Minimee to do any CSS or JS yet, and I hadn’t installed the extension, so I never woke up the beast.

One other clarification: I can use the Minimee tag pair as many times as needed on a template, wrapping any given set of files, correct?

John D Wells
# 7
Developer
John D Wells

Hi Ryan,

OK, I’m pretty sure that’ll be it then.

Yep, you can certainly use Minimee multiple times.  By default it will minify & combine all files it can find, creating a cached file for each tag pair; the “queue” parameter allows you to bundle multiple tag pair results together.

Definitely give a shout if ever you have trouble, always happy to help.

Cheers,
John