summaryrefslogtreecommitdiff
path: root/src/Text/Hakyll/Render.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Text/Hakyll/Render.hs')
-rw-r--r--src/Text/Hakyll/Render.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Text/Hakyll/Render.hs b/src/Text/Hakyll/Render.hs
index 2ff1b93..54df1b4 100644
--- a/src/Text/Hakyll/Render.hs
+++ b/src/Text/Hakyll/Render.hs
@@ -12,6 +12,7 @@ import Control.Monad
import System.FilePath
import System.Directory
+import System.IO
import Text.Hakyll.Page
import Text.Hakyll.Util
@@ -25,7 +26,9 @@ createContext = M.fromList . map packPair . M.toList
renderPage :: FilePath -> Page -> IO Page
renderPage templatePath page = do
- templateString <- B.readFile templatePath
+ handle <- openFile templatePath ReadMode
+ templateString <- liftM B.pack $ hGetContents handle
+ seq templateString $ hClose handle
let body = substitute templateString (createContext page)
return $ addContext "body" (B.unpack body) page