thegooglecodearchive / minify

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

Need Source subclass to use external URLs as sources #156

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I wish to be able to use external URLs like /js/myscript.js
So the behaviour should remain as if the file was local, but it should be 
loaded externally.

Original issue reported on code.google.com by ad...@mrmunk.dk on 30 Jan 2010 at 12:08

GoogleCodeExporter commented 9 years ago
A crude solution is already possible:
http://code.google.com/p/minify/wiki/CustomSource#Example:_Content_from_a_URL

But something that would be resilient to remote errors is forthcoming, with 
usage
looking something like: (in groupsConfig.php)

$src1 = new Minify_Source_Url(array(
  'url' => 'http://3rdparty.com/file.js'
  ,'contentPattern' => '@if this doesn\'t match, use backup@'
  ,'backupFile' => '/path/to/file_backup.js' 
  /* many more options */
));

return array(
  'js' => array('//js/file1.js', $src1, '//js/file3.js');
);

Original comment by mrclay....@gmail.com on 30 Jan 2010 at 9:20

GoogleCodeExporter commented 9 years ago
Great! Looking forward for true integration with Minify. 

(Offtopic: Thank you for making this great script, I've reduced HTTP requests 
from 16 
to 2!)

Original comment by ad...@mrmunk.dk on 1 Feb 2010 at 8:19