Grunt plugin for search and replace.
JavaScript
Pull request Compare This branch is 18 commits ahead of jharding:master.
Latest commit d0c547b Feb 20, 2016 5 @XhmikosR XhmikosR Update dependencies.

README.md

Build Status Dependency Status devDependency Status

grunt-sed

This is a fork of the original repo with the changes we needed since things were going pretty slow upstream.

Built on top of replace, grunt-sed is a Grunt plugin for performing search and replace on files.

Usage

This plugin is a multi task, meaning that Grunt will automatically iterate over all exec targets if a target is not specified.

Properties

  • path - File or directory to search. Defaults to '.'.
  • pattern - String or regex that will be replaced by replacement. Required.
  • replacement - The string that will replace pattern. Can be a function. Required.
  • recursive - If true, will recursively search directories. Defaults to false.
  • include - String or array of files to include.
  • exclude - String or array of files/folders to exclude.

Example

grunt.initConfig({
  pkg: grunt.file.readJSON('package.json'),

  sed: {
    version: {
      pattern: '%VERSION%',
      replacement: '<%= pkg.version %>',
      recursive: true,
      exclude: ['*.min.js', 'node_modules']
    }
  }
});

License

Copyright (c) 2013 Jake Harding
Licensed under the MIT License.