Created
May 4, 2017 23:13
-
-
Save starckio/ac1da52b9512122b05933a551efef21c to your computer and use it in GitHub Desktop.
Minimisation des fichiers CSS et affichage direct dans la balise <style></style>.
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() ?>"> | |
<style> | |
<?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/main.css'); | |
if($page->template() != 'default'){ | |
include('assets/css/templates/' . $page->template() . '.css'); | |
} | |
ob_end_flush(); ?> | |
</style> | |
</head> | |
<body> | |
<header class="header cf" role="banner"> | |
<a class="logo" href="<?php echo url() ?>"> | |
<img src="<?php echo url('assets/images/logo.svg') ?>" alt="<?php echo $site->title()->html() ?>" /> | |
</a> | |
<?php snippet('menu') ?> | |
</header> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment