summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicole Rauch <nicole.m@gmx.de>2016-08-14 19:37:29 +0200
committerNicole Rauch <nicole.m@gmx.de>2016-08-14 22:13:31 +0200
commit8f11bbd1d7cd81572ddc433aa1706bc2d2db4c8d (patch)
treea00761b7c62406f1d71098a4d7628151e4405dfa
parentec1486c4ba18452da4a5948477c1f8fe02c46d8f (diff)
downloadhakyll-8f11bbd1d7cd81572ddc433aa1706bc2d2db4c8d.tar.gz
Improved the compaction a bit more.
-rw-r--r--src/Hakyll/Web/CompressCss.hs3
-rw-r--r--tests/Hakyll/Web/CompressCss/Tests.hs2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs
index aac48b1..23adce2 100644
--- a/src/Hakyll/Web/CompressCss.hs
+++ b/src/Hakyll/Web/CompressCss.hs
@@ -39,11 +39,10 @@ compressSeparators str
| isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
| stripFirst = compressSeparators (drop 1 str)
| stripSecond = compressSeparators (head str : (drop 2 str))
- | isPrefixOf ";}" str = '}' : compressSeparators (drop 2 str)
| otherwise = head str : compressSeparators (drop 1 str)
where
prefix p = isPrefixOf p str
- stripFirst = or $ map prefix [" ", " {", " }", ";;"]
+ stripFirst = or $ map prefix [" ", " {", " }", ";;", ";}"]
stripSecond = or $ map prefix ["{ ", "} ", "; "]
--------------------------------------------------------------------------------
diff --git a/tests/Hakyll/Web/CompressCss/Tests.hs b/tests/Hakyll/Web/CompressCss/Tests.hs
index a7b94ab..221aa82 100644
--- a/tests/Hakyll/Web/CompressCss/Tests.hs
+++ b/tests/Hakyll/Web/CompressCss/Tests.hs
@@ -30,6 +30,8 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
-- compress separators
, "}" @=? compressCss "; }"
, "{};" @=? compressCss " { } ; "
+ -- compress whitespace even after this curly brace
+ , "}" @=? compressCss "; } "
-- but do not compress separators inside of constants
, "\" { } ; \"" @=? compressCss "\" { } ; \""
-- don't compress separators at the start or end of constants