Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/puranjayjain/gulp-replace-frommap
A tiny gulp plugin for replacing text using a object map between two regexes or strings
https://github.com/puranjayjain/gulp-replace-frommap
between gulp map regexes replace string tiny-gulp-plugin
Last synced: about 2 months ago
JSON representation
A tiny gulp plugin for replacing text using a object map between two regexes or strings
- Host: GitHub
- URL: https://github.com/puranjayjain/gulp-replace-frommap
- Owner: puranjayjain
- License: mit
- Created: 2016-12-20T07:38:07.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-18T15:49:35.000Z (almost 8 years ago)
- Last Synced: 2024-12-14T13:33:57.437Z (about 2 months ago)
- Topics: between, gulp, map, regexes, replace, string, tiny-gulp-plugin
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gulp-replace-frommap
A tiny gulp plugin for replacing text using a object map between two regexes or strings# Usage example
## gulpfile.js
```
var gulp = require('gulp');
var gulpReplaceFrommap = require('gulp-replace-frommap');gulp.task('test', function () {
return gulp.src('src/index.html')
.pipe(gulpReplaceFrommap({
before: 'class="',
after: '"',
map: './renaming.js'
}))
.pipe(gulp.dest('dist'));
});
```# Options
Its an object to be passed along with the constructor of the plugin
| Option | Description | Type
| --- | --- | --- |
| before | tag to start matching from | `String or Regex`
| after | tag to end matching to | `String or Regex`
| map | your map file relative to the current directory | `Object`**NOTE** if you are using regex for before and after then wrap them in a group, e.g /class/ should be done as /(class)/
```
* e.g
*
* before -> class="
* after -> "
* map -> './renaming.js' which contains something like module.exports = { someclass: 'a', ... };
* then
* it will replace all instances of goog with 2 which are between class=" and "
```# TODO
- [ ] streams support
- [ ] tests