Grunt task to save command output to file
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
tasks
.gitignore
.npmignore
.travis.yml
Gruntfile.coffee
MIT-LICENSE.TXT
README.md
package.json

README.md

grunt-redirect

Grunt task to save command output to file.

Build Status Dependency Status

Getting Started

Installation

$ npm install grunt-redirect

Requirements

  • grunt --version >= 0.4

Options

options.stdout

Type: Boolean Default value: true

Set options.stdout to true to save stdout.

options.stderr

Type: Boolean Default value: false

Set options.stderr to true to save stderr.

options.overwrite

Type: Boolean Default value: true

Set options.overwrite to true to overwrite output files.

Configuration Examples

redirect is a multitask, so you can use it similary to dist, build or etc...

grunt.initConfig({
    ...
    redirect: {
      dist: {
        options: {
          stdout: true,
          stderr: false,
          overwrite: true
        },
        files: {
          "path/to/file01": "command01 arg1 arg2 ...",
          "path/to/file02": "command02 arg1 arg2 ...",
          ...
        }
      }
    }
    ...
});

Usage Example to update JSON files

For example, bump version when you build your app.

grunt.initConfig({
    ...
    redirect: {
      build: {
        files: {
          "path/to/package.json": "command package.template data.json",
          "path/to/bower.json": "command bower.template data.json",
          "path/to/manifest.json": "command manifest.template data.json",
          ...
        }
      }
    }
    ...
});

License

MIT License (c) Hiroyuki Sano