blob: 72d38bef3e4a9b5cffe964a1236f54a648554c25 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
-- | A concrete 'ResourceProvider' that gets it's resources from the filesystem
--
module Hakyll.Core.ResourceProvider.FileResourceProvider
( fileResourceProvider
) where
import Control.Applicative ((<$>))
import qualified Data.ByteString.Lazy as LB
import Hakyll.Core.ResourceProvider
import Hakyll.Core.Identifier
import Hakyll.Core.Util.File
-- | Create a filesystem-based 'ResourceProvider'
--
fileResourceProvider :: IO ResourceProvider
fileResourceProvider = do
list <- map parseIdentifier <$> getRecursiveContents "."
return $ ResourceProvider
{ resourceList = list
, resourceString = readFile . toFilePath
, resourceLazyByteString = LB.readFile . toFilePath
}
|