summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-18 19:25:28 +0100
committerJasper Van der Jeugt <jaspervdj@gmail.com>2009-12-18 19:25:28 +0100
commitc1d93ebabfc03cf68ffabc7c2957c2c8935e4bc4 (patch)
tree1440f775b3a1681bc52c7f19c0b7da095173714b /src
parent01009d0ce38cbad5130b5861ebd7ab8ac8603877 (diff)
downloadhakyll-c1d93ebabfc03cf68ffabc7c2957c2c8935e4bc4.tar.gz
Worked on CompressCSS module.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Hakyll/CompressCSS.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Text/Hakyll/CompressCSS.hs b/src/Text/Hakyll/CompressCSS.hs
index b638654..5cb3b16 100644
--- a/src/Text/Hakyll/CompressCSS.hs
+++ b/src/Text/Hakyll/CompressCSS.hs
@@ -3,10 +3,21 @@ module Text.Hakyll.CompressCSS
) where
import Data.List
+import Text.Regex
-- | Compress CSS to speed up your site.
compressCSS :: String -> String
-compressCSS = stripComments
+compressCSS = compressSeparators
+ . compressWhitespace
+ . stripComments
+
+-- | Compresses certain forms of separators.
+compressSeparators :: String -> String
+compressSeparators str = subRegex (mkRegex "\\s*([;:])\\s*") str "\\1"
+
+-- | Compresses all whitespace.
+compressWhitespace :: String -> String
+compressWhitespace str = subRegex (mkRegex "\\s\\s*") str " "
-- | Function that strips CSS comments away.
stripComments :: String -> String