1module Text.Hakyll.CompressCSS
5import Data.List (isPrefixOf)
7import Text.Hakyll.Regex (substituteRegex)
9-- | Compress CSS to speed up your site.
10compressCSS :: String -> String
11compressCSS = compressSeparators
15-- | Compresses certain forms of separators.
16compressSeparators :: String -> String
17compressSeparators = substituteRegex "; *}" "}"
18 . substituteRegex " *([{};:]) *" "\\1"
19 . substituteRegex ";;*" ";"
21-- | Compresses all whitespace.
22compressWhitespace :: String -> String
23compressWhitespace = substituteRegex "[ \t\n][ \t\n]*" " "
25-- | Function that strips CSS comments away.
26stripComments :: String -> String
29 | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str
30 | otherwise = head str : stripComments (tail str)
32 eatComments str' | null str' = []
33 | isPrefixOf "*/" str' = drop 2 str'
34 | 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