summaryrefslogtreecommitdiff
path: root/lib/Hakyll/Core/Rules.hs
diff options
context:
space:
mode:
authorFraser Tweedale <frase@frase.id.au>2021-06-23 03:26:20 +1000
committerGitHub <noreply@github.com>2021-06-22 20:26:20 +0300
commit6885325146aa46adf255c55de0e0345a0f84961e (patch)
treed0df09061ace02e436f740ffbf44a37abc8b7a23 /lib/Hakyll/Core/Rules.hs
parent6d9bc845d5233c67e5eba3f54dcc7772ca1d79e2 (diff)
downloadhakyll-6885325146aa46adf255c55de0e0345a0f84961e.tar.gz
add 'forceCompile' rules modifier (#857)
Compilers that use data from sources other than local files may need to be recompiled, but Hakyll's file-based dependency checking does not handle this situation. Add a new kind of dependency called 'AlwaysOutOfDate'. If an item has this dependency, it will be unconditionally rebuilt. Also add the 'forceCompile' rule modifier, which is a user-friendly way to force recompilation of specific items. Example usage: forceCompile $ create ["foo"] $ do route $ idRoute compile $ unsafeCompiler $ doSomeIO
Diffstat (limited to 'lib/Hakyll/Core/Rules.hs')
-rw-r--r--lib/Hakyll/Core/Rules.hs9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Hakyll/Core/Rules.hs b/lib/Hakyll/Core/Rules.hs
index 41b9a73..695665a 100644
--- a/lib/Hakyll/Core/Rules.hs
+++ b/lib/Hakyll/Core/Rules.hs
@@ -29,6 +29,7 @@ module Hakyll.Core.Rules
, preprocess
, Dependency (..)
, rulesExtraDependencies
+ , forceCompile
) where
@@ -221,3 +222,11 @@ rulesExtraDependencies deps rules =
| (i, c) <- rulesCompilers ruleSet
]
}
+
+
+--------------------------------------------------------------------------------
+-- | Force the item(s) to always be recompiled, whether or not the
+-- dependencies are out of date. This can be useful if you are using
+-- I/O to generate part (or all) of an item.
+forceCompile :: Rules a -> Rules a
+forceCompile = rulesExtraDependencies [AlwaysOutOfDate]