on master help sign in
Add `getResourceFilePath`

See #130

commitc40cf286afacd130c1ddd28abacb3c484895076b authorJasper Van der Jeugt <m@jaspervdj.be> dateWed 3 Apr 2013, 12:07 (14 years ago) parent5e4adae
1 file changed+10−1
src/Hakyll/Core/Compiler.hs+10−1
src/Hakyll/Core/Compiler.hs+10−1
@@ -10,7 +10,7 @@ module Hakyll.Core.Compiler
1010 , getResourceBody
1111 , getResourceString
1212 , getResourceLBS
13− , getResourceWith
13+ , getResourceFilePath
1414
1515 , Internal.Snapshot
1616 , saveSnapshot
@@ -98,6 +98,15 @@ getResourceLBS :: Compiler (Item ByteString)
9898getResourceLBS = getResourceWith resourceLBS
9999
100100
101+--------------------------------------------------------------------------------
102+-- | Get the file path of the resource we are compiling
103+getResourceFilePath :: Compiler FilePath
104+getResourceFilePath = do
105+ provider <- compilerProvider <$> compilerAsk
106+ id' <- compilerUnderlying <$> compilerAsk
107+ return $ resourceFilePath provider id'
108+
109+
101110--------------------------------------------------------------------------------
102111-- | Overloadable function for 'getResourceString' and 'getResourceLBS'
103112getResourceWith :: (Provider -> Identifier -> IO a) -> Compiler (Item a)