Run only those tasks whose source files have changed.
CoffeeScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
test
.gitignore
.travis.yml
Gruntfile.coffee
LICENSE-MIT
README.md
package.json

README.md

grunt-update

NPM version Build Status Build Status

Run only those tasks whose source files are more recent than their destination targets.

This is like grunt-contrib-watch, but suitable for repeated invocation from the command line. It also doesn't get out of date if files changed while it wasn't running.

Getting Started

This plugin requires Grunt ~0.4.x

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-update --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-update');

The "update" task

Overview

In your project's Gruntfile, add a section named update to the data object passed into grunt.initConfig().

grunt.initConfig({
  update: {
    tasks: ['task1', 'task2', 'task3']
  },
})

Usage Examples

There are three formats you can use to configure this task.

Short

update: { tasks: ['copy', 'jade', 'sass'] }

This configures an update task that acts as though defined by:

grunt.registerTask 'update', ['copy', 'jade', 'sass']

except that each of the copy, jade, and sass tasks will be executed only if their respective destination files either do not exist, or are out of date with respect to their source files.

Medium

update: {
  app: ['copy:app', 'jade:app', 'sass:app']
  libs: ['copy:libs', 'jade:libs', 'sass:libs']
}

This configures update:app and update:lib tasks. (update runs them both.)

Long

update: {
  app:
    tasks: ['copy:app', 'jade:app', 'sass:app']
  libs:
    tasks: ['copy:libs', 'jade:libs', 'sass:libs']
}

Like the Medium format, this configures update:app and update:lib tasks (and update runs them both.)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

  • September 24, 20012 -- initial release