on master help sign in
Improved the compaction a bit more.
8f11bbdNicole Rauch
src/Hakyll/Web/CompressCss.hs+1−2
@@ -39,11 +39,10 @@ compressSeparators str
39 | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
39 | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str)
40 | stripFirst = compressSeparators (drop 1 str)
40 | stripFirst = compressSeparators (drop 1 str)
41 | stripSecond = compressSeparators (head str : (drop 2 str))
41 | stripSecond = compressSeparators (head str : (drop 2 str))
42− | isPrefixOf ";}" str = '}' : compressSeparators (drop 2 str)
43 | otherwise = head str : compressSeparators (drop 1 str)
42 | otherwise = head str : compressSeparators (drop 1 str)
44 where
43 where
45 prefix p = isPrefixOf p str
44 prefix p = isPrefixOf p str
46− stripFirst = or $ map prefix [" ", " {", " }", ";;"]
45+ stripFirst = or $ map prefix [" ", " {", " }", ";;", ";}"]
47 stripSecond = or $ map prefix ["{ ", "} ", "; "]
46 stripSecond = or $ map prefix ["{ ", "} ", "; "]
48
47
49--------------------------------------------------------------------------------
48--------------------------------------------------------------------------------
tests/Hakyll/Web/CompressCss/Tests.hs+2
@@ -30,6 +30,8 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
30 -- compress separators
30 -- compress separators
31 , "}" @=? compressCss "; }"
31 , "}" @=? compressCss "; }"
32 , "{};" @=? compressCss " { } ; "
32 , "{};" @=? compressCss " { } ; "
33+ -- compress whitespace even after this curly brace
34+ , "}" @=? compressCss "; } "
33 -- but do not compress separators inside of constants
35 -- but do not compress separators inside of constants
34 , "\" { } ; \"" @=? compressCss "\" { } ; \""
36 , "\" { } ; \"" @=? compressCss "\" { } ; \""
35 -- don't compress separators at the start or end of constants
37 -- don't compress separators at the start or end of constants