JSPM

  • Created
  • Published
  • Downloads 1339375
  • Score
    100M100P100Q187592F
  • License MIT

A simple utility to quickly replace text in one or more files.

Package Exports

  • replace-in-file

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (replace-in-file) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Replace in file

A simple utility to quickly replace text in one or more files.

Installation

npm install replace-in-file

Usage

var replace = require('replace-in-file');

replace({

  //Single file
  files: 'path/to/file',

  //Or multiple files
  files: [
    'path/to/file',
    'path/to/other/file',
  ],

  //Replacement to make (can be string or regex)
  replace: /Find me/g,
  with: 'Replacement'

}, function(error, changedFiles) {

  //Catch errors
  if (error) {
    return console.error('Error occurred:', error);
  }

  //List changed files
  console.log('Modified files:', changedFiles.join(', '));
});

License

(MIT License)

Copyright 2015, Adam Buczynski