From 1abdeee743d65d96c6f469213ca6e7ea823340a7 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Sat, 9 Jun 2018 13:25:21 -0700 Subject: 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. --- lib/Hakyll/Web/Feed.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Hakyll/Web/Feed.hs b/lib/Hakyll/Web/Feed.hs index 2cafe02..6e12146 100644 --- a/lib/Hakyll/Web/Feed.hs +++ b/lib/Hakyll/Web/Feed.hs @@ -35,7 +35,7 @@ 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 @@ -43,20 +43,19 @@ 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. -- cgit v1.2.3