本文整理汇总了PHP中Stylesheet::minify方法的典型用法代码示例。如果您正苦于以下问题:PHP Stylesheet::minify方法的具体用法?PHP Stylesheet::minify怎么用?PHP Stylesheet::minify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stylesheet
的用法示例。
在下文中一共展示了Stylesheet::minify方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: readCss
private static function readCss($pdf, $view)
{
$css = "";
$files = $view->getCssFiles();
foreach ($files as $file) {
$css = Stylesheet::minify($file);
$pdf->WriteHtml($css, 1);
}
return $css;
}
示例2: css
/**
* Outputs concatenated CSS for the specified view
* @param string view | the view - optional
*/
public function css()
{
$this->setContentType('text/css; charset=utf-8;');
$this->setCache(Date::SPAN_MONTH);
require_once Pimple::instance()->getBaseDir() . 'lib/Stylesheet.php';
$cacheDir = Pimple::instance()->getSiteDir() . 'cache/css/';
Dir::ensure($cacheDir);
$templates = array();
if (!Request::get('skipLayout', false)) {
$templates[] = 'application';
}
$view = Request::get('view', false);
if ($view) {
$templates[] = $view;
}
$used = array();
$isDebug = Settings::get(Settings::DEBUG, false);
foreach ($templates as $template) {
$cacheFile = $cacheDir . $template . '.css';
echo "/* {$template} */\n";
if ($isDebug) {
$view = new View($template);
$files = $view->getInternalCssFiles();
echo "/*FILES:\n\t" . implode("\n\t", $files) . '*/' . chr(10);
foreach ($files as $file) {
if (in_array($file, $used) || String::StartsWith($file, "http://") || String::StartsWith($file, "https://")) {
continue;
}
$used[] = $file;
echo "/*FILE:" . basename($file) . '*/' . chr(10) . Stylesheet::minify($file) . chr(10);
}
} else {
Dir::ensure(dirname($cacheFile));
if (!is_file($cacheFile)) {
File::truncate($cacheFile);
$view = new View($template);
$files = $view->getInternalCssFiles();
File::append($cacheFile, "/*FILES:\n\t" . implode("\n\t", $files) . '*/' . chr(10));
foreach ($files as $file) {
if (in_array($file, $used) || String::StartsWith($file, "http://") || String::StartsWith($file, "https://")) {
continue;
}
$used[] = $file;
File::append($cacheFile, "/*FILE:" . basename($file) . '*/' . chr(10) . Stylesheet::minify($file) . chr(10));
}
}
echo file_get_contents($cacheFile);
}
}
Pimple::end();
}