From e70605dfe681dbc0f79e0a8f426ac6c9fc9820a9 Mon Sep 17 00:00:00 2001 From: Nicole Rauch Date: Sun, 14 Aug 2016 19:51:45 +0200 Subject: We must avoid the compression of whitespace in constants by handling it in the same way. --- src/Hakyll/Web/CompressCss.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs index 23adce2..6667842 100644 --- a/src/Hakyll/Web/CompressCss.hs +++ b/src/Hakyll/Web/CompressCss.hs @@ -52,7 +52,15 @@ compressWhitespace [] = [] compressWhitespace str | isPrefixOf "\"" str = head str : retainConstants compressWhitespace "\"" (drop 1 str) | isPrefixOf "'" str = head str : retainConstants compressWhitespace "'" (drop 1 str) - | otherwise = replaceAll "[ \t\n\r]+" (const " ") str + | isPrefixOf "\t" str = compressWhitespace (' ' : (drop 1 str)) + | isPrefixOf "\n" str = compressWhitespace (' ' : (drop 1 str)) + | isPrefixOf "\r" str = compressWhitespace (' ' : (drop 1 str)) + + | isPrefixOf " \t" str = compressWhitespace (' ' : (drop 2 str)) + | isPrefixOf " \n" str = compressWhitespace (' ' : (drop 2 str)) + | isPrefixOf " \r" str = compressWhitespace (' ' : (drop 2 str)) + | isPrefixOf " " str = compressWhitespace (' ' : (drop 2 str)) + | otherwise = head str : compressWhitespace (drop 1 str) -------------------------------------------------------------------------------- -- cgit v1.2.3