diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-18 16:31:56 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-18 16:31:56 +0100 |
commit | 01009d0ce38cbad5130b5861ebd7ab8ac8603877 (patch) | |
tree | 4b43c75e294f9bc509cfb58cec85fe4c0a09d7e9 /src/Text/Hakyll | |
parent | 221c029dad1cef555b0540b152ec167e90937b16 (diff) | |
download | hakyll-01009d0ce38cbad5130b5861ebd7ab8ac8603877.tar.gz |
Started a CompressCss module.
Diffstat (limited to 'src/Text/Hakyll')
-rw-r--r-- | src/Text/Hakyll/CompressCSS.hs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/Text/Hakyll/CompressCSS.hs b/src/Text/Hakyll/CompressCSS.hs new file mode 100644 index 0000000..b638654 --- /dev/null +++ b/src/Text/Hakyll/CompressCSS.hs @@ -0,0 +1,18 @@ +module Text.Hakyll.CompressCSS + ( compressCSS + ) where + +import Data.List + +-- | Compress CSS to speed up your site. +compressCSS :: String -> String +compressCSS = stripComments + +-- | Function that strips CSS comments away. +stripComments :: String -> String +stripComments [] = [] +stripComments str | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str + | otherwise = (head str) : (stripComments $ tail str) + where eatComments str' | null str' = [] + | isPrefixOf "*/" str' = drop 2 str' + | otherwise = eatComments $ tail str' |