---------------------------------------------------------------------------------- | Module used for CSS compression. The compression is currently in a simple-- state, but would typically reduce the number of bytes by about 25%.moduleHakyll.Web.CompressCss(compressCssCompiler,compressCss)where--------------------------------------------------------------------------------importControl.Applicative((<$>))importData.Char(isSpace)importData.List(isPrefixOf)--------------------------------------------------------------------------------importHakyll.Core.CompilerimportHakyll.Core.ItemimportHakyll.Core.Util.String---------------------------------------------------------------------------------- | Compiler form of 'compressCss'compressCssCompiler::Compiler(ItemString)compressCssCompiler=fmapcompressCss<$>getResourceString---------------------------------------------------------------------------------- | Compress CSS to speed up your site.compressCss::String->StringcompressCss=compressSeparators.stripComments.compressWhitespace---------------------------------------------------------------------------------- | Compresses certain forms of separators.compressSeparators::String->StringcompressSeparators=replaceAll"; *}"(const"}").replaceAll" *([{};:]) *"(take1.dropWhileisSpace).replaceAll";+"(const";")---------------------------------------------------------------------------------- | Compresses all whitespace.compressWhitespace::String->StringcompressWhitespace=replaceAll"[ \t\n\r]+"(const" ")---------------------------------------------------------------------------------- | Function that strips CSS comments away.stripComments::String->StringstripComments[]=[]stripCommentsstr|isPrefixOf"/*"str=stripComments$eatComments$drop2str|otherwise=headstr:stripComments(drop1str)whereeatCommentsstr'|nullstr'=[]|isPrefixOf"*/"str'=drop2str'|otherwise=eatComments$drop1str'