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