diff options
author | kusut <tinokusut@gmail.com> | 2014-05-14 18:31:41 +0700 |
---|---|---|
committer | kusut <tinokusut@gmail.com> | 2014-05-14 18:31:41 +0700 |
commit | bd8305aeba7b76ca51ea50241336de10ee882c32 (patch) | |
tree | b6cbeda916d3aeba34fdbd7df4ad3f8024db3ce7 /web/tutorials/using-clay-with-hakyll.markdown | |
parent | 305e90e3460e3dc8e9138d7cd10925f25fb32c62 (diff) | |
download | hakyll-bd8305aeba7b76ca51ea50241336de10ee882c32.tar.gz |
Update using-clay-with-hakyll.markdown
add putCss, compact version, and cabal sandbox info
Diffstat (limited to 'web/tutorials/using-clay-with-hakyll.markdown')
-rw-r--r-- | web/tutorials/using-clay-with-hakyll.markdown | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/web/tutorials/using-clay-with-hakyll.markdown b/web/tutorials/using-clay-with-hakyll.markdown index e557c3d..c676a80 100644 --- a/web/tutorials/using-clay-with-hakyll.markdown +++ b/web/tutorials/using-clay-with-hakyll.markdown @@ -13,15 +13,25 @@ the CSS. This would be an example of such a file: ``` haskell {-# LANGUAGE OverloadedStrings #-} import Clay -import qualified Data.Text.Lazy.IO as T test :: Css test = ... main :: IO () -main = T.putStr $ render test +main = putCss test ``` +If you prefer the compact version, you're going to have an extra import: + + +``` haskell +import qualified Data.Text.Lazy.IO as T + +main :: IO () +main = T.putStr $ renderWith compact test +``` + + Let's assume such a file is called `css/foo.hs`. In our compiled site, we want to map this to `css/foo.css`. Hence, the route is a simple `setExtension`. For compilation, we simply pass the Clay file through `runghc` with no options. @@ -30,6 +40,9 @@ compilation, we simply pass the Clay file through `runghc` with no options. match "css/*.hs" $ do route $ setExtension "css" compile $ getResourceString >>= withItemBody (unixFilter "runghc" []) + +-- cabal sandbox users can use (unixFilter "cabal" ["exec", "runghc"]) +-- given that you've added cabal to your PATH ``` The major advantage of using this method (as opposed to importing the Clay files |