From 11dc1398a7fd26e726388b6c0f7057896f7e1d42 Mon Sep 17 00:00:00 2001 From: Will Mendes Date: Fri, 14 Dec 2012 14:52:49 -0200 Subject: Minify output in css and javascript code Minify output in css and javascript code --- system/core/Output.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'system/core/Output.php') diff --git a/system/core/Output.php b/system/core/Output.php index 5ec8c4bc0..11f484058 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -693,6 +693,7 @@ class CI_Output { break; case 'text/css': + case 'text/javascript': //Remove CSS comments $output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output); @@ -701,11 +702,12 @@ class CI_Output { // semi-colons, parenthesis, commas $output = preg_replace('!\s*(:|;|,|}|{|\(|\))\s*!', '$1', $output); - break; + // Remove spaces + $output = preg_replace('/ /s', ' ', $output); - case 'text/javascript': + // Remove breaklines and tabs + $output = preg_replace('/[\r\n\t]/', '', $output); - // Currently leaves JavaScript untouched. break; default: break; @@ -717,4 +719,4 @@ class CI_Output { } /* End of file Output.php */ -/* Location: ./system/core/Output.php */ \ No newline at end of file +/* Location: ./system/core/Output.php */ -- cgit v1.2.3-24-g4f1b