diff options
author | Michael Sloan <mgsloan@gmail.com> | 2018-06-09 13:25:21 -0700 |
---|---|---|
committer | Jasper Van der Jeugt <jaspervdj@gmail.com> | 2018-06-10 13:26:45 +0200 |
commit | 1abdeee743d65d96c6f469213ca6e7ea823340a7 (patch) | |
tree | 8874cf45e478b9b899fd686b19e2fb040e4739b6 /lib/Hakyll/Web | |
parent | af5ad67b2f1c441197dca8c522040f4864c9f6a5 (diff) | |
download | hakyll-1abdeee743d65d96c6f469213ca6e7ea823340a7.tar.gz |
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.
Diffstat (limited to 'lib/Hakyll/Web')
-rw-r--r-- | lib/Hakyll/Web/Feed.hs | 11 |
1 files 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. |