summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-12-17 09:52:38 +0100
committerAndrey Andreev <narf@bofh.bg>2012-12-17 09:52:38 +0100
commit6a53709e448bd6fd2603ede85ddd34b3388ec11f (patch)
tree56ce56ee41d0098fcb5f9a420a8fa9fdf4789128
parent3bc548e2c3be4cc76255a586821edf6d943657fb (diff)
parent11dc1398a7fd26e726388b6c0f7057896f7e1d42 (diff)
Merge pull request #2069 from willmendesneto/develop
Minify output in css and javascript code
-rw-r--r--system/core/Output.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/system/core/Output.php b/system/core/Output.php
index 98deff55c..2e239c787 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -780,6 +780,7 @@ class CI_Output {
break;
case 'text/css':
+ case 'text/javascript':
//Remove CSS comments
$output = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $output);
@@ -788,11 +789,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;
@@ -804,4 +806,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 */