From 6e53b30cb6901d2e88ec80e0736776166b36163f Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 7 Apr 2009 16:39:09 -0600 Subject: [PATCH] Use CSStidy to minify CSS file if using caching Big-time improvement in CSS filesize, *especially* if using a theme that overwrites the base theme - instead of including declarations twice, CSStidy will only write the final calculated value. For example, the base dimp page with the silver theme using the old caching method generated a 161 KB file. Running through CSS tidy generates a 96 KB file. --- imp/lib/IMP.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/imp/lib/IMP.php b/imp/lib/IMP.php index 7c6c739e3..14737d863 100644 --- a/imp/lib/IMP.php +++ b/imp/lib/IMP.php @@ -1662,6 +1662,13 @@ class IMP $out .= $tmp; } + /* Use CSS tidy to clean up file. */ + require_once HORDE_BASE . '/services/csstidy/class.csstidy.php'; + $css_tidy = new csstidy(); + $css_tidy->load_template('highest_compression'); + $css_tidy->parse($out); + $out = $css_tidy->print->plain(); + switch ($cache_type) { case 'filesystem': register_shutdown_function(array('IMP', 'filesystemGC'), 'css'); -- 2.11.0