-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.hs
40 lines (32 loc) · 1006 Bytes
/
site.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.IO.Class
import Data.Monoid
import Data.Time.Clock.POSIX
import Hakyll
main :: IO ()
main = do
ts <- liftIO getPOSIXTime
hakyll $ do
let ts' = show ts -- Do this once so miliseconds don't ever change.
match "images/**" $ do
route idRoute
compile copyFileCompiler
match "css/*.less" $ do
route $ setExtension (ts' ++ ".less")
compile compressCssCompiler
match "css/*.css" $ do
route $ setExtension (ts' ++ ".css")
compile compressCssCompiler
match "templates/*" $ compile templateCompiler
match "*.html" $ do
route $ setExtension "html"
compile $ do
let ctx = mconcat [ constField "ts" ts'
, defaultContext
]
getResourceBody
>>= loadAndApplyTemplate "templates/default.html" ctx
>>= relativizeUrls
match "robots.txt" $ do
route idRoute
compile copyFileCompiler