@@ -5,12 +5,26 @@ module Hakyll.Core.Configuration
55 , defaultHakyllConfiguration
66 ) where
77
8+import System.FilePath (takeFileName)
9+import Data.List (isPrefixOf, isSuffixOf)
10+
811data HakyllConfiguration = HakyllConfiguration
912 { -- | Directory in which the output written
1013 destinationDirectory :: FilePath
1114 , -- | Directory where hakyll's internal store is kept
1215 storeDirectory :: FilePath
13− } deriving (Show)
16+ , -- | Function to determine ignored files
17+ --
18+ -- In 'defaultHakyllConfiguration', the following files are ignored:
19+ --
20+ -- * files starting with a @.@
21+ --
22+ -- * files ending with a @~@
23+ --
24+ -- * files ending with @.swp@
25+ --
26+ ignoreFile :: FilePath -> Bool
27+ }
1428
1529-- | Default configuration for a hakyll application
1630--
@@ -18,4 +32,13 @@ defaultHakyllConfiguration :: HakyllConfiguration
1832defaultHakyllConfiguration = HakyllConfiguration
1933 { destinationDirectory = "_site"
2034 , storeDirectory = "_cache"
35+ , ignoreFile = ignoreFile'
2136 }
37+ where
38+ ignoreFile' path
39+ | "." `isPrefixOf` fileName = True
40+ | "~" `isSuffixOf` fileName = True
41+ | ".swp" `isSuffixOf` fileName = True
42+ | otherwise = False
43+ where
44+ fileName = takeFileName path