Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function minCSS( $string ) {
- /* Kill comments */
- $string = preg_replace('!/\*.*?\*/!s','', $string);
- $string = preg_replace('/\n\s*\n/',"\n", $string);
- /* Minification */
- $string = preg_replace('/[\n\r \t]/',' ', $string);
- $string = preg_replace('/ +/',' ', $string);
- $string = preg_replace('/ ?([,:;{}]) ?/','$1',$string);
- /* Remove Trailing Semicolon */
- $string = preg_replace('/;}/','}',$string);
- return $string;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement