jorge a7910c81a8 | ||
---|---|---|
.. | ||
LICENSE | ||
README.md | ||
index.js | ||
package.json |
README.md
rewrite-ext
Automatically re-write the destination extension of a filepath based on the source extension. e.g
.coffee
=>.js
. This will only rename the ext, no other path parts are modified.
Install with npm
npm i rewrite-ext --save
Running tests
Install dev dependencies.
npm i -d && npm test
Usage
var rewrite = require('rewrite-ext');
rewrite('abc.coffee');
//=> 'abc.js'
rewrite('abc.less');
//=> 'abc.css'
Explicitly pass an extension to use:
rewrite('./faux.js', '.foo');
//=> 'faux.foo'
More examples
rewrite('abc.styl');
//=> 'abc.css'
rewrite('abc.sass');
//=> 'abc.css'
rewrite('abc.scss');
//=> 'abc.css'
rewrite('abc.swig');
//=> 'abc.html'
rewrite('abc.hbs');
//=> 'abc.html'
rewrite('abc.md');
//=> 'abc.html'
rewrite('abc.tmpl');
//=> 'abc.html'
rewrite('./faux.js', '.bar');
//=> 'faux.bar'
rewrite('faux.js');
//=> 'faux.js'
rewrite('faux.css');
//=> 'faux.css'
rewrite('faux.html');
//=> 'faux.html'
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue
Author
Jon Schlinkert
License
Copyright (c) 2015 Jon Schlinkert
Released under the license
This file was generated by verb on February 22, 2015.