Permalink
Browse files

Use makeRelativeToProject with embedFile (for stack ghci)

The 'makeRelativeToProject' allows usage of package relative filepaths, even if
ghc's working dir is not the package directory.  This enables me to have a
locally modified version of hakyll as part of my stack project, and run "stack
ghci" to load my hakyll project + hakyll all into one ghci session.
  • Loading branch information...
mgsloan authored and jaspervdj committed Jun 9, 2018
1 parent af5ad67 commit 1abdeee743d65d96c6f469213ca6e7ea823340a7
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/Hakyll/Web/Feed.hs
View
@@ -35,28 +35,27 @@ import Hakyll.Web.Template.List
--------------------------------------------------------------------------------
import Data.FileEmbed (embedFile)
import Data.FileEmbed (makeRelativeToProject, embedFile)
import qualified Data.Text as T
import qualified Data.Text.Encoding as T
--------------------------------------------------------------------------------
rssTemplate :: String
rssTemplate = T.unpack $
T.decodeUtf8 $(embedFile "data/templates/rss.xml")
T.decodeUtf8 $(makeRelativeToProject "data/templates/rss.xml" >>= embedFile)
rssItemTemplate :: String
rssItemTemplate = T.unpack $
T.decodeUtf8 $(embedFile "data/templates/rss-item.xml")
T.decodeUtf8 $(makeRelativeToProject "data/templates/rss-item.xml" >>= embedFile)
atomTemplate :: String
atomTemplate = T.unpack $
T.decodeUtf8 $(embedFile "data/templates/atom.xml")
T.decodeUtf8 $(makeRelativeToProject "data/templates/atom.xml" >>= embedFile)
atomItemTemplate :: String
atomItemTemplate = T.unpack $
T.decodeUtf8 $(embedFile "data/templates/atom-item.xml")
T.decodeUtf8 $(makeRelativeToProject "data/templates/atom-item.xml" >>= embedFile)
--------------------------------------------------------------------------------
-- | This is a data structure to keep the configuration of a feed.

0 comments on commit 1abdeee

Please sign in to comment.