rte
Simple filepath re-writing for node.js projects. Useful for re-writing paths in grunt/gulp/assemble tasks or plugins.
Last updated 11 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install rte 
SYNC missed versions from official npm registry.

rte NPM version

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.

Current Tags

  • 2.0.1                                ...           latest (11 years ago)

19 Versions

  • 2.0.1                                ...           11 years ago
  • 2.0.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
  • 0.4.1                                ...           11 years ago
  • 0.4.0                                ...           11 years ago
  • 0.3.2                                ...           12 years ago
  • 0.3.1                                ...           12 years ago
  • 0.3.0                                ...           12 years ago
  • 0.2.2                                ...           12 years ago
  • 0.2.1                                ...           12 years ago
  • 0.2.0                                ...           12 years ago
  • 0.1.4                                ...           12 years ago
  • 0.1.3                                ...           12 years ago
  • 0.1.2                                ...           12 years ago
  • 0.1.1                                ...           12 years ago
  • 0.1.0                                ...           12 years ago
  • 0.0.3                                ...           12 years ago
  • 0.0.2                                ...           12 years ago
  • 0.0.1                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 18
Last Day 0
Last Week 18
Last Month 1
Dependencies (2)
Dev Dependencies (2)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |