-
-
/* - * Compress css file
- * by bbs.it-home.org
- /*
- header('Content-type: text/css');
- ob_start("compress");
- function compress($buffer) {
- /* remove comments */
- $buffer = preg_replace('!/*[^*]**+([^/][^*]** +)*/!', '', $buffer);
- /* remove tabs, spaces, newlines, etc. */
- $buffer = str_replace(array("rn", "r", "n", "t ", ' ', ' ', ' '), '', $buffer);
- return $buffer;
- }
/* Load the css file to be compressed*/
- include(' master.css');
- include('typography.css');
- include('grid.css');
- include('print.css');
- include('handheld.css');
ob_end_flush();
-
Copy code
Compared with the php code for compressing multiple CSS and JS files introduced before, this one is relatively simple and suitable for use as Getting Started Reference.
|