diff options
author | Nicole Rauch <nicole.m@gmx.de> | 2016-08-14 19:35:43 +0200 |
---|---|---|
committer | Nicole Rauch <nicole.m@gmx.de> | 2016-08-14 22:13:31 +0200 |
commit | ec1486c4ba18452da4a5948477c1f8fe02c46d8f (patch) | |
tree | 7bd48f1f0be1ca7d3a395bb9858d10abc763015b /src/Hakyll | |
parent | c6fdffc0a06c9185a062b1e4f9fb1088417754b5 (diff) | |
download | hakyll-ec1486c4ba18452da4a5948477c1f8fe02c46d8f.tar.gz |
Compacted the code by unifying all the similar prefix options.
Diffstat (limited to 'src/Hakyll')
-rw-r--r-- | src/Hakyll/Web/CompressCss.hs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/Hakyll/Web/CompressCss.hs b/src/Hakyll/Web/CompressCss.hs index c00b5ee..aac48b1 100644 --- a/src/Hakyll/Web/CompressCss.hs +++ b/src/Hakyll/Web/CompressCss.hs @@ -37,17 +37,14 @@ compressSeparators [] = [] compressSeparators str | isPrefixOf "\"" str = head str : retainConstants compressSeparators "\"" (drop 1 str) | isPrefixOf "'" str = head str : retainConstants compressSeparators "'" (drop 1 str) - | isPrefixOf " " str = compressSeparators (drop 1 str) - | isPrefixOf " {" str = compressSeparators (drop 1 str) - | isPrefixOf " }" str = compressSeparators (drop 1 str) - | isPrefixOf " ;" str = compressSeparators (drop 1 str) - | isPrefixOf ";;" str = compressSeparators (drop 1 str) - | isPrefixOf "{ " str = compressSeparators (head str : (drop 2 str)) - | isPrefixOf "} " str = compressSeparators (head str : (drop 2 str)) - | isPrefixOf "; " str = compressSeparators (head str : (drop 2 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 [" ", " {", " }", ";;"] + stripSecond = or $ map prefix ["{ ", "} ", "; "] -------------------------------------------------------------------------------- -- | Compresses all whitespace. |