1module Text.Hakyll.CompressCSS
5import Data.List (isPrefixOf)
6import Text.Hakyll.Regex (substitute)
8-- | Compress CSS to speed up your site.
9compressCSS :: String -> String
10compressCSS = compressSeparators
14-- | Compresses certain forms of separators.
15compressSeparators :: String -> String
16compressSeparators = substitute "; *}" "}"
17 . substitute " *([{};:]) *" "\\1"
18 . substitute ";;*" ";"
20-- | Compresses all whitespace.
21compressWhitespace :: String -> String
22compressWhitespace = substitute "[ \t\n][ \t\n]*" " "
24-- | Function that strips CSS comments away.
25stripComments :: String -> String
27stripComments str | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str
28 | otherwise = (head str) : (stripComments $ tail str)
29 where eatComments str' | null str' = []
30 | isPrefixOf "*/" str' = drop 2 str'
31 | otherwise = eatComments $ tail str'
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list