From 32f6d58884c13e162596cc19d542e97386fcc25f Mon Sep 17 00:00:00 2001 From: guptaaditya13 Date: Mon, 14 Dec 2015 17:01:39 +0530 Subject: [PATCH] added cssLoader to compress CSS on the fly. library used - Minify. Can also compress JS --- controller/cssLoader.php | 32 ++++++++++++++++++++++++++++++++ index.php | 2 ++ resources/minify | 1 + resources/path-converter | 1 + view/index.html | 9 +-------- 5 files changed, 37 insertions(+), 8 deletions(-) create mode 100644 controller/cssLoader.php create mode 160000 resources/minify create mode 160000 resources/path-converter diff --git a/controller/cssLoader.php b/controller/cssLoader.php new file mode 100644 index 00000000..bc15fd83 --- /dev/null +++ b/controller/cssLoader.php @@ -0,0 +1,32 @@ +add("assets/css/team.css"); +$minifier->add("assets/css/style.css"); +$minifier->add("assets/css/eventsmain.css"); +$minifier->add("assets/css/intro.css"); +$minifier->add("assets/css/jquery-ui.structure.min.css"); +$minifier->add("assets/css/jquery-ui.min.css"); +$minifier->add("assets/css/jquery-ui.theme.min.css"); + +// or we can just add plain CSS +// $css = 'body { color: #000000; }'; +// $minifier->add($css); + +// save minified file to disk +// $minifiedPath = '/path/to/minified/css/file.css'; +// $minifier->minify($minifiedPath); +header("Content-type: text/css"); +echo $minifier->minify(); +?> \ No newline at end of file diff --git a/index.php b/index.php index 403ef92b..b50f1353 100644 --- a/index.php +++ b/index.php @@ -25,6 +25,8 @@ public function Redirect($url) if (preg_match($base . '$@', $url)) { require ('view/index.html'); +} elseif ( preg_match($base .'cssLoader/home/?$@', $url, $match ) ) { + require ('controller/cssLoader.php'); } elseif ( preg_match($base .'events/?$@', $url, $match ) ) { require ('controller/events.php'); } elseif (preg_match($base . 'allEvents/?$@', $url)) { diff --git a/resources/minify b/resources/minify new file mode 160000 index 00000000..cecee1ce --- /dev/null +++ b/resources/minify @@ -0,0 +1 @@ +Subproject commit cecee1ce5b153c3721cde75c4ce9426ac09fa49c diff --git a/resources/path-converter b/resources/path-converter new file mode 160000 index 00000000..95c5496b --- /dev/null +++ b/resources/path-converter @@ -0,0 +1 @@ +Subproject commit 95c5496b0865c1d3bff4d10898f4d5ea338079a7 diff --git a/view/index.html b/view/index.html index 9d86e4d1..7cc2743f 100755 --- a/view/index.html +++ b/view/index.html @@ -5,14 +5,7 @@ Anwesha '16 - - - - - - - - +