gruntjs / gruntjs/grunt

Option to only run task if input files have changed since last run

Open
#866 5 comments 0 reactions 0 assignees View on GitHub
Component: tasks needs discussion
Dominant language
JavaScript
Stars
12.2k
Forks
1.5k
PR merge metrics
No merged PRs in 30d

Description

_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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.