summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core/Rules/Default.hs
diff options
context:
space:
mode:
authorAlexey Kreshchuk <akrsch@gmail.com>2013-10-16 01:39:04 +0400
committerAlexey Kreshchuk <akrsch@gmail.com>2013-10-16 01:39:04 +0400
commit712ffa39b5857fdc5cdae1db38a177267a430b11 (patch)
treeb4b5f7c46f769dc176932894bbafe0878da99e3a /src/Hakyll/Core/Rules/Default.hs
parenta6ae4eb99dd5f9957adc3b5fe4011e69b9681e4c (diff)
downloadhakyll-712ffa39b5857fdc5cdae1db38a177267a430b11.tar.gz
Track metadata dependencies
I had to prepend some Rules to global Rules set. This might be possible to replaced by a correct Store.set call. I also had to prepend some Compile rules.
Diffstat (limited to 'src/Hakyll/Core/Rules/Default.hs')
-rw-r--r--src/Hakyll/Core/Rules/Default.hs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Hakyll/Core/Rules/Default.hs b/src/Hakyll/Core/Rules/Default.hs
new file mode 100644
index 0000000..ccca1bd
--- /dev/null
+++ b/src/Hakyll/Core/Rules/Default.hs
@@ -0,0 +1,23 @@
+{-# LANGUAGE OverloadedStrings #-}
+module Hakyll.Core.Rules.Default
+ ( internalRules
+ , addMetadataDependencies
+ )
+where
+import Hakyll.Core.Rules
+import Hakyll.Core.Compiler
+import Hakyll.Core.Compiler.Internal (compilerTellDependencies)
+import Hakyll.Core.Metadata (getMatches, metadataFiles)
+import Hakyll.Core.Identifier.Pattern(fromList)
+
+internalRules :: Rules ()
+internalRules = do
+ match "metadata" $ compile $ makeItem ()
+ match "**/metadata" $ compile $ makeItem ()
+
+--------------------------------------------------------------------------------
+addMetadataDependencies :: Compiler ()
+addMetadataDependencies =
+ compilerTellDependencies . map IdentifierDependency =<< getMatches . fromList =<< fmap metadataFiles getUnderlying
+
+