on master help sign in
Merge pull request #258 from kusut/patch-1
f364b17Jasper Van der Jeugt
web/tutorials/using-clay-with-hakyll.markdown+15−2
@@ -13,15 +13,25 @@ the CSS. This would be an example of such a file:
13``` haskell
13``` haskell
14{-# LANGUAGE OverloadedStrings #-}
14{-# LANGUAGE OverloadedStrings #-}
15import Clay
15import Clay
16−import qualified Data.Text.Lazy.IO as T
17
16
18test :: Css
17test :: Css
19test = ...
18test = ...
20
19
21main :: IO ()
20main :: IO ()
22−main = T.putStr $ render test
21+main = putCss test
23```
22```
24
23
24+If you prefer the compact version, you're going to have an extra import:
25+
26+
27+``` haskell
28+import qualified Data.Text.Lazy.IO as T
29+
30+main :: IO ()
31+main = T.putStr $ renderWith compact test
32+```
33+
34+
25Let's assume such a file is called `css/foo.hs`. In our compiled site, we want
35Let's assume such a file is called `css/foo.hs`. In our compiled site, we want
26to map this to `css/foo.css`. Hence, the route is a simple `setExtension`. For
36to map this to `css/foo.css`. Hence, the route is a simple `setExtension`. For
27compilation, we simply pass the Clay file through `runghc` with no options.
37compilation, 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.
30match "css/*.hs" $ do
40match "css/*.hs" $ do
31 route $ setExtension "css"
41 route $ setExtension "css"
32 compile $ getResourceString >>= withItemBody (unixFilter "runghc" [])
42 compile $ getResourceString >>= withItemBody (unixFilter "runghc" [])
43+
44+-- cabal sandbox users can use (unixFilter "cabal" ["exec", "runghc"])
45+-- given that you've added cabal to your PATH
33```
46```
34
47
35The major advantage of using this method (as opposed to importing the Clay files
48The major advantage of using this method (as opposed to importing the Clay files