diff options
-rw-r--r-- | src/Hakyll/Web/CompressCss.hs | 2 | ||||
-rw-r--r-- | tests/Hakyll/Web/CompressCss/Tests.hs | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs index 8f67c7c..a032b10 100644 --- a/src/Hakyll/Web/CompressCss.hs +++ b/src/Hakyll/Web/CompressCss.hs @@ -65,6 +65,8 @@ compressWhitespace str stripComments :: String -> String stripComments [] = [] stripComments str + | isPrefixOf "\"" str = head str : retainConstants stripComments "\"" (drop 1 str) + | isPrefixOf "'" str = head str : retainConstants stripComments "'" (drop 1 str) | isPrefixOf "/*" str = stripComments $ eatComments $ drop 2 str | otherwise = head str : stripComments (drop 1 str) where diff --git a/tests/Hakyll/Web/CompressCss/Tests.hs b/tests/Hakyll/Web/CompressCss/Tests.hs index 065a588..c3fc840 100644 --- a/tests/Hakyll/Web/CompressCss/Tests.hs +++ b/tests/Hakyll/Web/CompressCss/Tests.hs @@ -30,7 +30,10 @@ tests = testGroup "Hakyll.Web.CompressCss.Tests" $ concat compressCss "abc ' \t\n\r ' xyz" -- strip comments - , "" @=? compressCss "/* abc { } ;; \n\t\r */" + , "before after" @=? compressCss "before /* abc { } ;; \n\t\r */ after" + -- don't strip comments inside constants + , "before \"/* abc { } ;; \n\t\r */\" after" + @=? compressCss "before \"/* abc { } ;; \n\t\r */\" after" -- compress separators , "}" @=? compressCss "; }" |