summaryrefslogtreecommitdiff
path: root/src/Hakyll
diff options
context:
space:
mode:
authorNicole Rauch <nicole.m@gmx.de>2016-08-14 19:54:43 +0200
committerNicole Rauch <nicole.m@gmx.de>2016-08-14 22:13:31 +0200
commitce9730758e5d9317c3b0f060a7db995f52467115 (patch)
tree70ad7d0e374eca396aa10be76fbbbb51831b9919 /src/Hakyll
parente70605dfe681dbc0f79e0a8f426ac6c9fc9820a9 (diff)
downloadhakyll-ce9730758e5d9317c3b0f060a7db995f52467115.tar.gz
Compressed the code by grouping the guards together.
Diffstat (limited to 'src/Hakyll')
-rw-r--r--src/Hakyll/Web/CompressCss.hs15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs
index 6667842..8f67c7c 100644
--- a/src/Hakyll/Web/CompressCss.hs
+++ b/src/Hakyll/Web/CompressCss.hs
@@ -52,16 +52,13 @@ compressWhitespace [] = []
compressWhitespace str
| isPrefixOf "\"" str = head str : retainConstants compressWhitespace "\"" (drop 1 str)
| isPrefixOf "'" str = head str : retainConstants compressWhitespace "'" (drop 1 str)
- | isPrefixOf "\t" str = compressWhitespace (' ' : (drop 1 str))
- | isPrefixOf "\n" str = compressWhitespace (' ' : (drop 1 str))
- | isPrefixOf "\r" str = compressWhitespace (' ' : (drop 1 str))
-
- | isPrefixOf " \t" str = compressWhitespace (' ' : (drop 2 str))
- | isPrefixOf " \n" str = compressWhitespace (' ' : (drop 2 str))
- | isPrefixOf " \r" str = compressWhitespace (' ' : (drop 2 str))
- | isPrefixOf " " str = compressWhitespace (' ' : (drop 2 str))
+ | replaceOne = compressWhitespace (' ' : (drop 1 str))
+ | replaceTwo = compressWhitespace (' ' : (drop 2 str))
| otherwise = head str : compressWhitespace (drop 1 str)
-
+ where
+ prefix p = isPrefixOf p str
+ replaceOne = or $ map prefix ["\t", "\n", "\r"]
+ replaceTwo = or $ map prefix [" \t", " \n", " \r", " "]
--------------------------------------------------------------------------------
-- | Function that strips CSS comments away.