@@ -4,7 +4,7 @@ module Text.Hakyll.Render
4 renderAndConcat,
4 renderAndConcat,
5 renderChain,
5 renderChain,
10import Text.Template hiding (render)
10import Text.Template hiding (render)
@@ -18,6 +18,7 @@ import System.IO
18import Text.Hakyll.Page
18import Text.Hakyll.Page
19import Text.Hakyll.Renderable
19import Text.Hakyll.Renderable
20import Text.Hakyll.File
20import Text.Hakyll.File
21+import Text.Hakyll.CompressCSS
22-- | Execute an IO action only when the cache is invalid.
23-- | Execute an IO action only when the cache is invalid.
23depends :: FilePath -- ^ File to be rendered or created.
24depends :: FilePath -- ^ File to be rendered or created.
@@ -68,7 +69,10 @@ static source = depends destination [source]
68 (makeDirectories destination >> copyFile source destination)
69 (makeDirectories destination >> copyFile source destination)
69 where destination = toDestination source
70 where destination = toDestination source
71−-- | Mark a whole directory as static.
72+-- | Render a css file, compressing it.
72−staticDirectory :: FilePath -> IO ()
73+css :: FilePath -> IO ()
73−staticDirectory dir =
74+css source = depends destination [source] css'
74− getRecursiveContents dir >>= mapM_ static
75+ where destination = toDestination source
76+ css' = do h <- openFile source ReadMode
77+ contents <- hGetContents h
78+ writeFile destination (compressCSS contents)