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 with npm
$ npm i rte --save
var rte = require('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'
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Jon Schlinkert
Copyright © 2014-2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on May 31, 2015.