- Details
- Geschreven door Mark Vink
- Categorie: Techniek
Minimize and combine css files to optimize file loading.
<?php header('Content-type: text/css'); header ("cache-control: must-revalidate"); ob_start("compress"); function compress($buffer) { /* remove comments */ $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); /* remove tabs, spaces, newlines, etc. */ $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); return $buffer; } /* your css files */ include('voorbeeld.css'); ob_end_flush(); ?>