summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicole Rauch <nicole.m@gmx.de>2016-08-14 19:23:10 +0200
committerNicole Rauch <nicole.m@gmx.de>2016-08-14 22:13:31 +0200
commit0404185e835fb11bec70882b695df7b53c3dd451 (patch)
tree892f139455955ef9129069309f93fd1a74929ce3 /src
parentc0a86b3d7e759fa060e091df0a3ae7d0df6354ce (diff)
downloadhakyll-0404185e835fb11bec70882b695df7b53c3dd451.tar.gz
We need to constantly check whether we are at the start of a constant, not just once.
Diffstat (limited to 'src')
-rw-r--r--src/Hakyll/Web/CompressCss.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs
index ce7239f..c00b5ee 100644
--- a/src/Hakyll/Web/CompressCss.hs
+++ b/src/Hakyll/Web/CompressCss.hs
@@ -37,11 +37,17 @@ compressSeparators [] = []
compressSeparators str
| isPrefixOf "\"" str = head str : retainConstants compressSeparators "\"" (drop 1 str)
| isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
- | otherwise =
- replaceAll "; *}" (const "}") $
- replaceAll " *([{};]) *" (take 1 . dropWhile isSpace) $
- replaceAll ";+" (const ";") str
- where
+ | isPrefixOf " " str = compressSeparators (drop 1 str)
+ | isPrefixOf " {" str = compressSeparators (drop 1 str)
+ | isPrefixOf " }" str = compressSeparators (drop 1 str)
+ | isPrefixOf " ;" str = compressSeparators (drop 1 str)
+ | isPrefixOf ";;" str = compressSeparators (drop 1 str)
+ | isPrefixOf "{ " str = compressSeparators (head str : (drop 2 str))
+ | isPrefixOf "} " str = compressSeparators (head str : (drop 2 str))
+ | isPrefixOf "; " str = compressSeparators (head str : (drop 2 str))
+ | isPrefixOf ";}" str = '}' : compressSeparators (drop 2 str)
+ | otherwise = head str : compressSeparators (drop 1 str)
+
--------------------------------------------------------------------------------
-- | Compresses all whitespace.