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

     

Pre-pending not working with initial slash

Bug Report

JamesB
JamesB

Hey John-
this is a followup to this thread: http://devot-ee.com/add-ons/support/minimee/viewthread/14189#46543

Sorry, I got busy with a couple things and didn’t have time to get in and further debug. So I took a look through the add-on code a little bit, and it looks like the issue is it will only pre-pend the URL if there is not an initial slash. So “url(/images/imagename.png)” doesn’t do anything, but “url(images/imagename.png)” works correctly. So it seems like that is where the bug is.

John D Wells
# 1
Developer
John D Wells

Hi James,

First of all, I’m sorry for not responding earlier - I could have sworn I had! Clearly not.

So yes, you’re correct that the prepending does not occur if the path to the asset begins with a slash.  And that’s actually by design of the underlying library which Minimee uses (Minify https://github.com/mrclay/minify).

It also makes sense when you think about it - the prepending’s main purpose is so that if the cached CSS ends up in a different place on your server, and you were using relative paths to your images, then you’d need to rewrite those paths to maintain the link. But with a leading slash it doesn’t matter where the cached version ends up on your server.

Still, it’s worth a clarification in the docs.  Added to the list!

Cheers,
John