Skip to content

Easily generate destination filepaths for node.js projects. Handle dynamic src-dest mappings with ease. Great for grunt, gulp and assemble projects.

License

Notifications You must be signed in to change notification settings

jonschlinkert/rte

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

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.

About

Easily generate destination filepaths for node.js projects. Handle dynamic src-dest mappings with ease. Great for grunt, gulp and assemble projects.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published