Minify css
Minify css

file:b/css/.gitignore (new)
--- /dev/null
+++ b/css/.gitignore
@@ -1,1 +1,2 @@
+*.min.css
 

--- a/include/controller/ControllerBase.class.php
+++ b/include/controller/ControllerBase.class.php
@@ -250,7 +250,7 @@
 			// backwards compatibility
 			$stylesheet = 'gitphpskin.css';
 		}
-		$this->tpl->assign('stylesheet', $stylesheet);
+		$this->tpl->assign('stylesheet', preg_replace('/\.css$/', '', $stylesheet));
 
 		$this->tpl->assign('javascript', GitPHP_Config::GetInstance()->GetValue('javascript', true));
 		$this->tpl->assign('pagetitle', GitPHP_Config::GetInstance()->GetValue('title', $gitphp_appstring));

--- a/templates/header.tpl
+++ b/templates/header.tpl
@@ -16,8 +16,16 @@
       <link rel="alternate" title="{$project->GetProject()} log (Atom)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=atom" type="application/atom+xml" />
       <link rel="alternate" title="{$project->GetProject()} log (RSS)" href="{$SCRIPT_NAME}?p={$project->GetProject()|urlencode}&amp;a=rss" type="application/rss+xml" />
     {/if}
+    {if file_exists('css/gitphp.min.css')}
+    <link rel="stylesheet" href="css/gitphp.min.css" type="text/css" />
+    {else}
     <link rel="stylesheet" href="css/gitphp.css" type="text/css" />
-    <link rel="stylesheet" href="css/{$stylesheet}" type="text/css" />
+    {/if}
+    {if file_exists("css/$stylesheet.min.css")}
+    <link rel="stylesheet" href="css/{$stylesheet}.min.css" type="text/css" />
+    {else}
+    <link rel="stylesheet" href="css/{$stylesheet}.css" type="text/css" />
+    {/if}
     {if $extracss}
     <style type="text/css">
     {$extracss}

--- a/util/minify.sh
+++ b/util/minify.sh
@@ -17,6 +17,10 @@
 JSEXT=".js"
 MINEXT=".min.js"
 
+CSSDIR="css"
+CSSEXT=".css"
+MINCSSEXT=".min.css"
+
 rm -f ${JSDIR}/*${MINEXT}
 
 for i in ${JSDIR}/*${JSEXT}; do
@@ -24,3 +28,10 @@
 	java -jar "${COMPRESSORDIR}/${COMPRESSORJAR}" --charset utf-8 -o "${i%$JSEXT}${MINEXT}" "${i}"
 done
 
+rm -f ${CSSDIR}/*${MINCSSEXT}
+
+for i in ${CSSDIR}/*${CSSEXT}; do
+	echo "Minifying ${i}..."
+	java -jar "${COMPRESSORDIR}/${COMPRESSORJAR}" --charset utf-8 -o "${i%$CSSEXT}${MINCSSEXT}" "${i}"
+done
+

comments