zhanjh / minify

Automatically exported from code.google.com/p/minify
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Does it support urls from other domains? #197

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Say if I include jquery ui (js and css) from the google CDN, would minify be 
able to handle this?

Original issue reported on code.google.com by balup...@gmail.com on 14 Oct 2010 at 11:50

GoogleCodeExporter commented 9 years ago
It's best to keep the CDN libraries separate.

That said, you *can* pull content from URLs, but some PHP knowledge is 
necessary and there's no error handling at this point: 
http://code.google.com/p/minify/wiki/CustomSource#Non-File_Sources

Original comment by mrclay....@gmail.com on 15 Oct 2010 at 9:57

GoogleCodeExporter commented 9 years ago
I take it when including CSS in this matter that includes and uls within the 
CSS will not be re-written?

The use case is for a Zend View Helper HeadLink rewrite, to rewrite all the 
individual script tags into one combined and minified one. I've already written 
one such implementation for javascript at:
http://github.com/balupton/balphp/blob/master/lib/Bal/View/Helper/HeadScriptBund
ler.php

But for it's CSS implementation I had to start evaluating other options when I 
discovered includes and urls will have to be re-written.

Original comment by balup...@gmail.com on 16 Oct 2010 at 12:37

GoogleCodeExporter commented 9 years ago
Correct. Minify only does URI rewriting if the Minify_Source object has a 
non-empty filename property. 

FYI the rewriting is done by this class:
http://code.google.com/p/minify/source/browse/branches/2.1.4/min/lib/Minify/CSS/
UriRewriter.php

@includes would indeed be a problem.

Original comment by mrclay....@gmail.com on 16 Oct 2010 at 12:53

GoogleCodeExporter commented 9 years ago
Thanks for the real quick reply :-)

That class is definitely a good start with what I would like to do. Hopefully I 
can come up with a hybrid solution, thanks a whole bunch :-)

Original comment by balup...@gmail.com on 16 Oct 2010 at 1:03