diff options
author | Francis Rowe <info@gluglug.org.uk> | 2015-05-27 16:39:36 (EDT) |
---|---|---|
committer | Francis Rowe <info@gluglug.org.uk> | 2015-05-27 16:39:36 (EDT) |
commit | c75e3d259dad8c37829af91651d017a89dee3fb7 (patch) | |
tree | bad024bf00b19b659e1fc3c576e16808df47ad75 /site/functions.php | |
parent | f7f1d9caa381c4cb2353a7da37d7808a171887f1 (diff) | |
download | libreboot.org-c75e3d259dad8c37829af91651d017a89dee3fb7.zip libreboot.org-c75e3d259dad8c37829af91651d017a89dee3fb7.tar.gz libreboot.org-c75e3d259dad8c37829af91651d017a89dee3fb7.tar.bz2 |
minify html and css
Diffstat (limited to 'site/functions.php')
-rw-r--r-- | site/functions.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/site/functions.php b/site/functions.php index fb023b9..b90a35e 100644 --- a/site/functions.php +++ b/site/functions.php @@ -18,7 +18,21 @@ */ /* Functions */ - + + /* Minified HTML output (note: needs work for <pre> tags) */ + function miniHtml($strHtml) { + return $strHtml = preg_replace( + array('/(\s)+/s', '/\>[^\S ]+/s', '/[^\S ]+\</s'), + array('\\1', '>', '<'), + $strHtml + ); + } + + /* Minified CSS output */ + function miniCss($strCss) { + return preg_replace("/\r|\n/", "", $strCss); + } + /* Generic function for showing a list of URLs */ function mirrorList($arrayMirrors,$strNotFoundMessage,$forIndexStart,$forIndexbelow) { |