All Projects → jonschlinkert → gulp-frep

jonschlinkert / gulp-frep

Licence: MIT License
A find and replace utility, using Frep. Replace strings or arrays of strings with an array of replacement patterns.

Programming Languages

javascript
184084 projects - #8 most used programming language

gulp-frep (find and replace) NPM version

A find and replace utility, using Frep. Replace strings or arrays of strings with an array of replacement patterns.

Getting Started

Install the module with: npm install gulp-frep

Usage

var gulp = require('gulp');
var frep = require('gulp-frep');

gulp.task('frep', function() {
  gulp.src('./src/foo.html')
    .pipe(frep(patterns))
    .pipe(gulp.folder('./dist/foo.html'))
});

Example replacement patterns

var patterns: [
  {
    // Strip tags from HTML
    pattern: /(<([^>]+)>)/ig,
    replacement: ''
  },
  {
    // Normalize and condense newlines
    pattern: /(\r\n|\n){2,}/g,
    replacement: '\n'
  }
];

See the frep docs for options.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

Author

License

Copyright (c) 2014 Jon Schlinkert Licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].