Extension, Plugin

Developer
Supported

Minimee

ExpressionEngine 2

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

     

You must be logged in to post.

V2 Release

Feature Request

John D Wells
Developer
John D Wells

To Whom May Be Listening,

For far too long I’ve been touting a “Version 2” of Minimee, only to see time pass by and the feature list grow.  Which is not to say I haven’t been toiling away. Rather I’ve been working on things, off and on, for ages.  And it seems that quite often I’m taking two steps forward and one step back.

As it turns out, there are two “tiny” features that are causing me grief, stunting progress towards implementing other features. so I’m considering dropping them.  What would be great to hear from you, Dear Community, is if anyone would even notice…

combine=“no” and minify=“no”

There has always been the ability to turn on and off Minimee’s “minifying” and “combining” of files.  Supporting these requires a crazy circus act of if/else/then/buts/foreach cruft, and for every “thing” I want to do to a file, it has to be done at every turn.  It’s annoying, and I’ve long been wondering if it’s even necessary.

I’ve pretty much convinced myself already that minify=“no” is pointless; that if you want to disable minification, you might as well be disabling Minimee altogether, which has always been possible.

And I’m also thinking that there’s no real advantage to combine=“no” - that again it defeats the purpose of what Minimee is supposed to be doing.  Besides, if you ever really need a paricular CSS or JS file to be Minimee’d on it’s own, simply wrap it in it’s own tag pair.

But I’d really appreciate anyone’s input. It’s impossible for me to predict all the ways Minimee is being used (and expected to behave).  Aside from when you’re building/debugging a site, has anyone ever found real-world usefulness with either of these features?

Many, MANY thanks for your time, and your ideas.

Keep calm and carry on, EErs.
John

Erwin Heiser
# 1
Erwin Heiser

FWIW, I have both settings on no during building/debugging and almost always on yes when the site goes live.
So, if that’s holding it back I guess I can just as well comment out the minimee tags in my template during dev :)
Just my 2 cents though.

aelvan
# 2
aelvan

Actually, I think the combination combine=“yes” and minify=“no”, has a very important use-case.

I ran into an issue some months ago on a site where I was using Automin. The site was responsive, and developed mobile-first style, with respond.js as poly-fill for older IE versions. Thing is, when the css was minified, respond.js wasn’t able to detect the media queries, and older versions of IE ended up with the mobile version of the site, which wasn’t acceptable. I had to remove Automin all-together for CSS, and then had five CSS stylesheets loading in the head. I combined these manually to eliminate the number of loading files, but it would have been much more flexible if I could use combine=“yes” minify=“no”. The thing is, gzipping css and js when serving it makes the minifying actually less important, so the main reason for using something like Minimee is the combining so you get less page requests. And of course the cache-busting when you update files, that’s awesome.

Of course, the best thing would be if the minify process didn’t mess up my media queries, but… Maybe it’s doesn’t with Minimee..? :)

PressEnter
# 3
PressEnter

I don’t see the usefulness of either option, as the whole point of the add-on is to combine and minify CSS and JS.

I too have run into issues with JS fixes for Media Queries, but those have always been issues with the JS library I was using, not the CSS.

Mark Croxton
# 4
Mark Croxton

Hi John

I think you can lose combine=“no” - like you say, we can just disable minimee during dev -but like aelvan I have found it sometimes necessary to disable minify.

I have a feature request though: now that we have some new juicy template hooks, it would be great to have the minimee display tag return placeholders to the template that then get replaced with the minified asset links just before final output (using template_post_parse). Then you would never need worry about parse order when injecting assets into the header or footer of your page using queues.

John D Wells
# 5
Developer
John D Wells

Really appreciate the feedback chaps…

@aelvan & Mark - Good f’ing points!  I’ve been concerned about the debugging issue and you’re absolutely right, the important thing then is the ability to turn of minification.

And as it turns out, the refactoring I’ve done will make it super easy to keep minify=“no” as a feature (I can actually improve it to allow for minify_css or minify_js too).  It was staring me in the face this whole time!  So OK, that config option stayscombine=“no” is still potentially on the chopping block…

Mark, the idea about placeholders + template_post_parse is really interesting.  I’ll have a tinker and see if I make progress, might eventually ping you something to see if it fits with your ideas…

Million thanks,
John

aelvan
# 6
aelvan

Ah, forgot, but yeah, combine=“no” is just silly. ;)

Alex Kendrick
# 7
Alex Kendrick

I saw your tweet and since I totally love this add-on (THANKS!) and use it on every install I thought I’d post my two cents.

I never use the combine=“no” parameter but having unminified css and js for development is handy. But the way I set it up is with your handy config overrides. This makes it nice because I can just set it once and forget it.

// disable minimee on local server
if ($_SERVER['SERVER_ADDR'== "127.0.0.1"{  
  $config[
'minimee_disable''y';
Lee
# 8
Lee

It’s simple, if edge cases are a hassle for you - drop them. I use {!——}

John D Wells
# 9
Developer
John D Wells

Thanks again to everyone who’s chimed in on this.  Super super helpful.

Based on the above feedback (and a tweet from Stephen Lewis) I’ve decided to leave both features in.  There’s already been a strong case made to keep minify=“no”, and combine=“no” seems to be a valuable debug tool.

BUT, the good news (for me) is that I’ve managed to restructure Minimee so that neither feature adds complexity to the code.  PHEW.  And in fact the refactoring has freed me to improve upon those features.

So in addition to turning on/off minification & combination, you’ll also be able to do it for specific types (css, js, and in the case of minification, html). This can be done either at the tag level, or via config - Minimee2 is built so that every setting & option may be set either by config/db OR parameter. Or via a third party hook. ;)

Now, off to work on the parse/queue idea that Mark has suggested…

Thanks all,
John

Sean Delaney
# 10
Sean Delaney

John,

A bit late to the party, sorry.

Before reading everyone else’s input I would have said there is no need for options to allow enabling/disabling certain features.  Compressed for example.  I feel features like this, in fact all features should be enabled by default with the option to turn off.  However I’m now more on the side or Mark and Eelvan.

Interested to see what comes from this.

John D Wells
# 11
Developer
John D Wells

Hi Sean,

Thanks for your feedback - I’m definitely glad I persevered and found a way to keep all those features in.

By the way, V2’s caching mechanism is tweaked so that the cache folder doesn’t get filled up with hundreds of files while you develop.  It doesn’t necessarily make your Room Service add-on obsolete though.  I’ll explain more closer to the release.

Cheers,
John

Sean Delaney
# 12
Sean Delaney

I’ve updated Room Service to an extension so it runs before Minimee but having issue picking a suitable hook. So it might be a non-runner…

John D Wells
# 13
Developer
John D Wells

For those interested, I’ve finally pushed a version2 branch up onto Github.  Please consider it beta until it’s onto the master branch.  Any brave testers are invited to kick the tires.

Highlights include:

- Individually turn off and on minification & combining for all assets (CSS, JS and HTML)
- Hooks for 3rd party integration (see Minimee+LESS*, and MSMinimee**)
- ALL settings can be specified via config or extension, and then overridden at the tag level
- Path & URL settings can now be relative to site root
- New exp:minimee:link tag returns just the URL to your minimee’d asset
- Allow for different settings for each CSS/JS asset
- Disable or override the URLs which are prepended to image & @import paths in CSS
- New priority=”” parameter allows you to queue assets into a specific order
- For EE2.4 and above, assets are queue’d after the exp:minimee:display tag is parsed (combined with priority=”“, parse order becomes irrelevant! I’ve called it the “Croxton Queue”.)
- New cleanup=”” setting for deleting expired caches (that’s for you, Sean)
- Verbose template debugging messages to help easily track down errors
- Improved handling of fully-qualified URLs of local assets

* Minimee+LESS parses LESS files and works seamlessly alongside Minimee’s processing. I’m using this as my first foray into LESS, so would appreciate any seasoned LESSers to help test.

** MSMinimee is a module that allows you to specify Minimee settings per-site. Sites without specific settings simply inherit Minimee’s own settings.

As always, thanks for your time and contribution!
John