Skip to content

Commit

Permalink
Also trim whitespace around colons.
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoleRauch committed Aug 14, 2016
1 parent ea0a8d5 commit 9f850a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Hakyll/Web/CompressCss.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ compressSeparators str
| otherwise = head str : compressSeparators (drop 1 str)
where
isConstant = or $ map (isOfPrefix str) ["\"", "'"]
stripFirst = or $ map (isOfPrefix str) [" ", " {", " }", ";;", ";}"]
stripSecond = or $ map (isOfPrefix str) ["{ ", "} ", "; "]
stripFirst = or $ map (isOfPrefix str) [" ", " {", " }", " :", ";;", ";}"]
stripSecond = or $ map (isOfPrefix str) ["{ ", "} ", ": ", "; "]

--------------------------------------------------------------------------------
-- | Compresses all whitespace.
Expand Down
2 changes: 2 additions & 0 deletions tests/Hakyll/Web/CompressCss/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat
-- don't compress whitespace around separators in constants in the middle of a string
, "abc '{ '" @=? compressCss "abc '{ '"
, "abc \"{ \"" @=? compressCss "abc \"{ \""
-- compress whitespace after colons
, "abc:xyz" @=? compressCss "abc : xyz"
-- compress multiple semicolons
, ";" @=? compressCss ";;;;;;;"
]
Expand Down

0 comments on commit 9f850a9

Please sign in to comment.