@@ -0,0 +1,18 @@
1+module Text.Hakyll.CompressCSS
2+ ( compressCSS
3+ ) where
4+
5+import Data.List
6+
7+-- | Compress CSS to speed up your site.
8+compressCSS :: String -> String
9+compressCSS = stripComments
10+
11+-- | Function that strips CSS comments away.
12+stripComments :: String -> String
13+stripComments [] = []
14+stripComments str | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str
15+ | otherwise = (head str) : (stripComments $ tail str)
16+ where eatComments str' | null str' = []
17+ | isPrefixOf "*/" str' = drop 2 str'
18+ | otherwise = eatComments $ tail str'