Last active
August 29, 2015 14:23
-
-
Save starckio/235defc20492bb8d1713 to your computer and use it in GitHub Desktop.
Reducing codes css in php for Kirby CMS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | |
<title><?php echo $site->title()->html() ?> | <?php echo $page->title()->html() ?></title> | |
<meta name="description" content="<?php echo $site->description()->html() ?>"> | |
<meta name="keywords" content="<?php echo $site->keywords()->html() ?>"> | |
<?php include_once('minify.php') ?> | |
</head> | |
<body> | |
<header class="header cf" role="banner"> | |
<a class="logo" href="<?php echo $site->language()->url() ?>"> | |
<img src="<?php echo url('assets/images/logo.svg') ?>" alt="<?php echo $site->title()->html() ?>" /> | |
</a> | |
<?php snippet('menu') ?> | |
</header> | |
<main class="main" role="main"> | |
<div class="text"> | |
<h1><?php echo $page->title()->html() ?></h1> | |
<?php echo $page->text()->kirbytext() ?> | |
</div> | |
</main> | |
<footer class="footer cf" role="contentinfo"> | |
<p><?php echo l::get('made-with') ?></p> | |
</footer> | |
<?php echo js('assets/js/jquery-latest.min.js') ?> | |
<?php echo js('assets/js/scripts.js') ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style media="all" rel="stylesheet" type="text/css"> | |
<?php ob_start("minify"); | |
function minify($buffer) { | |
$buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); | |
$buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); | |
$buffer = str_replace(array(' } ',' }','} ',';}'), '}', $buffer); | |
$buffer = str_replace(array(' { ',' {','{ '), '{', $buffer); | |
$buffer = str_replace(array(' : ',' :',': '), ':', $buffer); | |
return $buffer; } | |
include('assets/css/fonts.css'); | |
include('assets/css/styles.css'); | |
ob_end_flush(); ?> | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment