johndwells / Minimee

Minimize & combine your CSS and JS files. Minify your HTML. Because size (still) DOES matter.

Home Page:http://johndwells.github.com/Minimee

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HTML only partially minifying

opened this issue · comments

Hi John,

Although HTML minification appears to be working, upon closer inspection, it appears as though it's not minifying as much as I'd expect it to be.

As an example, I did a quick test with the EE home page.

Here's the original source: http://pastie.org/private/gzp2r8apz5p6osplk14a

Here's the source when minimised using Minimee 2.0.1: http://pastie.org/private/xrkuehedgurxbvrp7jzbg

Here's the source when run through a random online HTML minifier I found (http://www.willpeavy.com/minifier/): http://pastie.org/private/fe6dvehuppejzwv4oqwrw (I had to cut this short as Pastie kept throwing me a 503 error with the full minimised source)

As you can see, Minimee only appears to be partially minimising the HTML. Here's a screenshot of the above three results when compared together - top is the original, middle is Minimee, and the bottom is minimised using the online HTML minifier: http://cl.ly/image/1M0b3r223i0C

What do you think about this? Is this by design, a bug, or could I be doing something wrong here?

Thanks,

Stephen

Hi Stephen,

Two things regarding this:

1 - I currently only run HTML minification on the templates, so CSS and SCRIPT content is not minified. It is on the roadmap to add this in, ideally by configuration so that people can choose if they want the extra processing.

2 - Every HTML minification library is slightly different, Minimee uses Minify (code.google.com/p/minify). From what I've seen, Minify may not be the most agressive, but it seems quite stable. It's possible to include other minification libraries as configuration options. I'll add it to the list!

Cheers,
John

Hi John,

Just replying to your two comments:

  1. I think I'm fine with this as I was only trying to minimise the template HTML. But when you say no CSS or SCRIPT content is minified, are you talking about any inline CSS/JS in the actual template itself? I'm fine with however it works, but just want to make sure I'm understanding what you're saying so I know what to look out for when testing/using Minimee.
  2. Yes, it would be great to have the option of a more agressive HTML minifier. I assume that 'css_library' only affects the CSS, and that a feature request would be for a new 'html_library' or similar override that had options in addition to minifier for mimising the HTML?

Thanks,

Stephen

Hi Stephen,

Yep I was only referring to inline JS & CSS. I'll make a note for other HTML minification libraries.

Thanks for taking the time to test and give feedback/ideas, much appreciated!

Cheers,
John

Hi John,

No, thank you for the great add-on, and it sounds like it's only going to get better still.

I'm watching the repo so I'll keep an eye out for when any new features (like more aggressive HTML minification libraries) are pushed live and I'll be sure to test them out.

Thanks,

Stephen

Hi Stephen,

I wanted to let you know that with the 2.1.0 release, HTML minification will automatically also minify inline CSS and JS. I still haven't gotten to adding other HTML minification libraries, but once the dust settles of the 2.x launch, I'll see what I can do.

Cheers,
John

Hi John,

Thanks for letting me know about this. I'll download 2.1.0 and give that a try.

Thanks also in advance for looking at the other HTML minification libraries once the dust settles after the 2.x launch.

Thanks,

Stephen