grunt
grunt copied to clipboard
Option to only run task if input files have changed since last run
Apologies if this has already been suggested / discussed – I couldn't find a relevant existing issue.
To very roughly mimic make's dependency tracking – and hence reduce build / watch times – it'd be great if there was an easy way to only run a task if the files in its input file set have changed since last run.
It might work something like this:
- Store a hash of the contents of all source files in the Files Array object for this task & target in a temporary file
- On subsequent calls:
- Re-evaluate the hash
- If changed, execute the task then update the hash
- If unchanged, skip the task
The hash should probably also at least include the config for that task/target in grunt.config, so that config changes trigger re-evaluation too – maybe the whole Gruntfile.
I'm not saying this covers every eventuality, but it'd be a starting point.