mirror of
https://github.com/ilyakooo0/hakyll.git
synced 2024-10-06 09:17:15 +03:00
Improved the compaction a bit more.
This commit is contained in:
parent
ec1486c4ba
commit
8f11bbd1d7
@ -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 ["{ ", "} ", "; "]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user