in config file $groupSources = array( 'js' => array('file1.js', 'file2.js') ,'css' => array('file1.css', 'file2.css', 'file3.css') ) during HTML generation $jsBuild = new Minify_Build($groupSources['js']); $cssBuild = new Minify_Build($groupSources['css']); $script = ""; $link = ""; in min.php Minify::serve('Groups', array( 'groups' => $groupSources ,'setExpires' => (time() + 86400 * 365) ));
Author: Stephen Clay (steve@mrclay.org)
示例#1
0
文件: epesi.php 项目: 62BRAINS/EPESI
 public static final function prepare_minified_files($arr)
 {
     $out = array();
     require_once 'libs/minify/Minify/Build.php';
     foreach ($arr as $loader => $css) {
         if ($loader == '') {
             foreach ($css as $c2) {
                 $out[] = $c2;
             }
         } else {
             if (DEBUG_CSS) {
                 foreach ($css as $c2) {
                     $csses_build = new Minify_Build(array($c2));
                     $f = $csses_build->uri($loader . '?' . http_build_query(array('f' => array($c2))));
                     $out[] = $f;
                 }
             } else {
                 $csses_build = new Minify_Build($css);
                 $f = $csses_build->uri($loader . '?' . http_build_query(array('f' => array_values($css))));
                 $out[] = $f;
             }
         }
     }
     return $out;
 }
示例#2
0
function test_Minify_Build()
{
    global $thisDir;
    $file1 = $thisDir . '/_test_files/css/paths_prepend.css';
    $file2 = $thisDir . '/_test_files/css/styles.css';
    $maxTime = max(filemtime($file1), filemtime($file2));
    $b = new Minify_Build($file1);
    assertTrue($b->lastModified == filemtime($file1), 'Minify_Build : single file path');
    $b = new Minify_Build(array($file1, $file2));
    assertTrue($maxTime == $b->lastModified, 'Minify_Build : multiple file paths');
    $b = new Minify_Build(array($file1, new Minify_Source(array('filepath' => $file2))));
    assertTrue($maxTime == $b->lastModified, 'Minify_Build : file path and a Minify_Source');
    assertTrue($b->uri('/path') == "/path?{$maxTime}", 'Minify_Build : uri() with no querystring');
    assertTrue($b->uri('/path?hello') == "/path?hello&{$maxTime}", 'Minify_Build : uri() with existing querystring');
}
示例#3
0
文件: index.php 项目: cretzu89/EPESI
ini_set('include_path', 'libs/minify' . PATH_SEPARATOR . '.' . PATH_SEPARATOR . 'libs' . PATH_SEPARATOR . ini_get('include_path'));
require_once 'Minify/Build.php';
$jquery = DEBUG_JS ? 'libs/jquery-1.11.3.js' : 'libs/jquery-1.11.3.min.js';
$jquery_migrate = DEBUG_JS ? 'libs/jquery-migrate-1.2.1.js' : 'libs/jquery-migrate-1.2.1.min.js';
$jses = array('libs/prototype.js', $jquery, $jquery_migrate, 'libs/jquery-ui-1.10.1.custom.min.js', 'libs/HistoryKeeper.js', 'include/epesi.js');
if (!DEBUG_JS) {
    $jsses_build = new Minify_Build($jses);
    $jsses_src = $jsses_build->uri('serve.php?' . http_build_query(array('f' => array_values($jses))));
    echo "<script type='text/javascript' src='{$jsses_src}'></script>";
} else {
    foreach ($jses as $js) {
        print "<script type='text/javascript' src='{$js}'></script>";
    }
}
$csses = array('libs/jquery-ui-1.10.1.custom.min.css');
$csses_build = new Minify_Build($csses);
$csses_src = $csses_build->uri('serve.php?' . http_build_query(array('f' => array_values($csses))));
?>
		<link type="text/css" href="<?php 
print $csses_src;
?>
" rel="stylesheet"></link>

		<style type="text/css">
			<?php 
if (DIRECTION_RTL) {
    print 'body { direction: rtl; }';
}
?>
			#epesiStatus {
  				/* Netscape 4, IE 4.x-5.0/Win and other lesser browsers will use this */
示例#4
0
文件: help.php 项目: cretzu89/EPESI
ModuleManager::load_modules();
if (!isset($_SESSION['client']['help']) || !($h = $_SESSION['client']['help'])) {
    $h = array();
    $h[''] = array(false, '');
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	  <meta content="text/html; charset=UTF-8" http-equiv="content-type">
	  <title>epesi help</title>
	  <link href="help.css" type="text/css" rel="stylesheet"/>
<?php 
require_once 'libs/minify/Minify/Build.php';
$jses = array('libs/prototype.js', 'modules/Base/MainModuleIndicator/help.js');
$jsses_build = new Minify_Build($jses);
$jsses_src = $jsses_build->uri('../../../serve.php?' . http_build_query(array('f' => array_values($jses))));
?>
		<script type="text/javascript" src="<?php 
print $jsses_src;
?>
"></script>
		<script type="text/javascript">
		help.max=<?php 
echo count($h);
?>
		</script>
</head>
<body>
		<table id="banner" border="0" cellpadding="0" cellspacing="0">
			<tr>