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

     

[ADDED in 2.1.1] Use original paths config option in Minimee2

Feature Request

Darren Miller (dmlogic)
Darren Miller (dmlogic)

For development, it would be really helpful if Minimee could work in an *almost* disabled way.

That is, parse all the queued files, display them where required (including delayed display) but use the original paths.

This has turned up because I’m making full use of the ability to place queue tags in really strange places in Minimee2.

During development and debugging, I need the combining and minification turned off in case I need to insepct source in the browser.

The problem occurs when I want to see which CSS file is being referenced and I can only see the MD5 name. If the original paths were used I could have all my templates and queues set as they need to be but still see original filenames in the source. I could then flick a switch in my config to turn on full Minimee functionality for production.

John D Wells
# 1
Developer
John D Wells

Hi dmlogic,

Thanks for the feature request - I’ve thought about this before, I can appreciate the need for it.  Let me know if something like this would meet your needs:

Introduce a “preserve_filename” config option which would, when combining=“no”, tell Minimee to create cache names based off their original source asset.  So a CSS file like:

/assets/css/globals.css

Might be saved as:

/cache/assets.css.globals.1483023.css

Would that do it?  If so, I can put something together and might ask you to test it out.

Cheers,
John

Darren Miller (dmlogic)
# 2
Darren Miller (dmlogic)

Hi John

I guess you’ve suggested that route as it’s simpler to implement than forcing the use of original paths?

In which case, yes I think that would do the trick. Happy to test

thanks
Darren

John D Wells
# 3
Developer
John D Wells

Hi Darren,

Preserving paths as well as filenames would have a few gotchas - more folder permissions issues, and of course what to do about {stylesheet=} assets and external URLs.

Have a play with the attached.  There’s an additional “Preserve Filename” option in the Extensions panel, or if you’re using EE’s $config, it’s “preserve_filename” as the settings key.

I’ve gone ahead and implemented it regardless of whether you’re combining or not, since the filename ends up being a concatenated string of all assets within so it will still work.  Let me know if you find the results “readable” enough, or how you might like to see it tweaked.

While you test this, I’ll do a bit of research into what sort of filename length limits I may need to consider with this feature, since it does introduce potentially very long names.

Cheers!
John

File Attachments
JDW_-_Minimee_ef84217a451b.zip  (File Size: 132KB - Downloads: 54)
Darren Miller (dmlogic)
# 4
Darren Miller (dmlogic)

Looking good. I’ve not really hammered it, but the yes/no on `preserve_filename` is doing exactly as you described.

Thank you.

John D Wells
# 5
Developer
John D Wells

Great, thanks for giving it a go.  I’m not going to push this update to Git just yet, like I said I’m going to look at filename length considerations, and see if anything else might crop up during my tests.  I’ll keep you updated if anything changes.

Thanks again!
John

John D Wells
# 6
Developer
John D Wells

Hi Darren,

I wanted you to know that the upcoming 2.1.1 release will contain this new feature, however I’ve renamed the config variable from what I gave you.

Instead of `preserve_filename`, it is now `hash_method`.  If you’re configuring Minimee via EE’s $config, you’ll want to update your code; if you’re configuring via Minimee’s Extension, you’ll need to revisit the extensions panel, and restore the setting, since I have not included an upgrade script from the build I gave you earlier.

You can grab the changes up on the “bleeding edge” branch for v2:

https://github.com/johndwells/Minimee/tree/version2

Any trouble, just shout!

Cheers,
John

Darren Miller (dmlogic)
# 7
Darren Miller (dmlogic)

so it should be:

$config['minimee']['hash_method''yes'

  ?

John D Wells
# 8
Developer
John D Wells

Ah, no - sorry, forgot to say that now the parameter accepts one of 3 values:

‘sha1’ (default)
‘md5’
‘sanitize’

So you’ll want to do:

$config['minimee']['hash_method''sanitize'

Apologies for not specifying that change - doing a lot at once here!

Cheers,
John

Darren Miller (dmlogic)
# 9
Darren Miller (dmlogic)

got it, thanks John.

btw, off topic, but I think this might be of interest if it gets confirmed as an issue (which I believe it will):
http://devot-ee.com/add-ons/support/ce-cache/viewthread/7458

John D Wells
# 10
Developer
John D Wells

Hi Darren,

Thanks for the heads up - I’ll participate in that thread in case I can help.

Cheers,
John