diff options
author | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-18 19:38:25 +0100 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2009-12-18 19:38:25 +0100 |
commit | ef4c166a1c1c918f47ee46933beb02e3edb8569d (patch) | |
tree | 14f25b8a0c5698bac5416f67ec61a459758fe95f /src/Text/Hakyll/Render.hs | |
parent | c1d93ebabfc03cf68ffabc7c2957c2c8935e4bc4 (diff) | |
download | hakyll-ef4c166a1c1c918f47ee46933beb02e3edb8569d.tar.gz |
Changed to a more general directory command, and added css command.
Diffstat (limited to 'src/Text/Hakyll/Render.hs')
-rw-r--r-- | src/Text/Hakyll/Render.hs | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/Text/Hakyll/Render.hs b/src/Text/Hakyll/Render.hs index 87467f7..7e9d55c 100644 --- a/src/Text/Hakyll/Render.hs +++ b/src/Text/Hakyll/Render.hs @@ -4,7 +4,7 @@ module Text.Hakyll.Render renderAndConcat, renderChain, static, - staticDirectory + css ) where import Text.Template hiding (render) @@ -18,6 +18,7 @@ import System.IO import Text.Hakyll.Page import Text.Hakyll.Renderable import Text.Hakyll.File +import Text.Hakyll.CompressCSS -- | Execute an IO action only when the cache is invalid. depends :: FilePath -- ^ File to be rendered or created. @@ -68,7 +69,10 @@ static source = depends destination [source] (makeDirectories destination >> copyFile source destination) where destination = toDestination source --- | Mark a whole directory as static. -staticDirectory :: FilePath -> IO () -staticDirectory dir = - getRecursiveContents dir >>= mapM_ static +-- | Render a css file, compressing it. +css :: FilePath -> IO () +css source = depends destination [source] css' + where destination = toDestination source + css' = do h <- openFile source ReadMode + contents <- hGetContents h + writeFile destination (compressCSS contents) |