on 01009d0 help sign in
hakyll/src/Text/Hakyll/CompressCSS.hs
18 lines 611 B history raw
1module Text.Hakyll.CompressCSS
2 ( compressCSS
3 ) where
5import Data.List
7-- | Compress CSS to speed up your site.
8compressCSS :: String -> String
9compressCSS = stripComments
11-- | Function that strips CSS comments away.
12stripComments :: String -> String
13stripComments [] = []
14stripComments 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'