1
0
mirror of https://github.com/mrclay/minify.git synced 2025-02-06 07:48:44 +01:00

Minify.php : + combine()

builder/_index.html : Unix newlines
This commit is contained in:
Steve Clay 2008-09-04 00:38:08 +00:00
parent 86c09a1cd0
commit f9378dc345
2 changed files with 29 additions and 6 deletions

View File

@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<title>Minify URI Builder</title>
@ -7,7 +7,7 @@
#sources li {margin:0 0 0 40px}
#sources li input {margin-left:2px}
#add {margin:5px 0 1em 40px}
#update, #uriTable {display:none}
#update, #uriTable {display:none}
b {color:#c00}
</style>
</head>
@ -29,11 +29,11 @@ a URI to serve them as one file through Minify.</p>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
// workaround required to test when /min isn't child of web root
// workaround required to test when /min isn't child of web root
var src = location.pathname.replace(/\/[^\/]*$/, '/index.js').substr(1);
document.write('<\script type="text/javascript" src="../?f=' + src + '"><\/script>');
</script>
<!--[
This comment remains because the "[" makes it look like an IE conditional comment
<!--[
This comment remains because the "[" makes it look like an IE conditional comment
-->

View File

@ -323,6 +323,29 @@ class Minify {
}
}
/**
* Return combined minified content for a set of sources
*
* No internal caching will be used and the content will not be HTTP encoded.
*
* @param array $sources array of filepaths and/or Minify_Source objects
*
* @return string
*/
public static function combine($sources)
{
$cache = self::$_cache;
self::$_cache = null;
$out = self::serve('Files', array(
'files' => (array)$sources
,'quiet' => true
,'encodeMethod' => ''
,'lastModifiedTime' => 0
));
self::$_cache = $cache;
return $out['content'];
}
/**
* On IIS, create $_SERVER['DOCUMENT_ROOT']
*