rte
v2.0.1
Published
Simple filepath re-writing for node.js projects. Useful for re-writing paths in grunt/gulp/assemble tasks or plugins.
Downloads
188
Maintainers
Readme
rte
Simple filepath re-writing for node.js projects. Useful for re-writing paths in grunt/gulp/assemble tasks or plugins.
v2.0 released! Breaking changes!
.process()
is now.stringify()
Install
Install with npm
$ npm i rte --save
Usage
var rte = require('rte');
API
rte
Generate a file path from properties on the given object.
Examples:
When a source
file path is passed as the first argument, it will
be parsed and the resulting object will merged with the data
object (properties on the data object take precendence).
Params
src
{String}: Optionally pass a source file path to parse.dest
{String}: Template for the destination file path with:properties
to replace.data
{Object}: Object with values to pass to the dest.
Examples
rte(':a/:b:.c', { a: 'aaa', b: 'bbb', c: 'js' });
//=> 'aaa/bbb/c.js'
rte('a/b/c.html', ':destbase/:basename', { destbase: 'foo' });
//=> 'foo/c.html'
Related projects
- gulp-routes: Add middleware to run for specified routes in your gulp pipeline.
- gulp-rte: Better dest handling for Gulp.
- gulp-dest: Gulp plugin for easily defining destination paths using path variables.
- gulp-extname: gulp plugin to dynamically rewrite dest extensions based on src extensions.
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on May 31, 2015.