Wondering what’s next for npm?Check out our public roadmap! »

grunt-then

1.0.0 • Public • Published

grunt-then v1.0.0

Schedule a Function to be called without ever registering it via grunt.registerTask. This is called an anonymous task.

grunt
  .run("coffee")
  .then(function () {
    console.log(this.name)
  })

As seen above, the this context in anonymous tasks is just like in normal tasks.

Plus, you can fail an anonymous task early (just like in normal tasks).

grunt.task
  .then(function () {
    return false // synchronous failure
  })
  .then(function () {
    var done = this.async()
    performAsyncOperation(function () {
      done(false) // asynchronous failure
    })
  })

Debugging is easier when an anonymous task has a description. Of course, this is optional.

grunt.task.then("A description of what I'm doing", function () {
  // do cool grunty things
})

If the --verbose flag is used and a description is provided, it will be printed when the anonymous task starts.

Schedule an existing task to be called with a single-use configuration. This is called an anonymous target.

grunt.then("clean", {
  // Calls the 'clean' task with temporary configuration (after the previous task completes).
})

install

npm install --save-dev grunt-then

In your Gruntfile:

grunt.loadNpmTasks("grunt-then")

Use load-grunt-tasks when you have more than one NPM task to load.

Install

npm i grunt-then

DownloadsWeekly Downloads

4,650

Version

1.0.0

License

none

Last publish

Collaborators

  • avatar