Socket
Book a DemoInstallSign in
Socket

rewrite-ext

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

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.

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
5.4K
-3.63%
Maintainers
1
Weekly downloads
 
Created
Source

rewrite-ext NPM version NPM monthly downloads NPM total downloads Linux Build Status

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

Install with npm:

$ npm install --save rewrite-ext

Usage

var rewrite = require('rewrite-ext');

Automatically re-write extensions to the mapped extensions from ext-map:

console.log(rewrite('abc.coffee'));
//=> 'abc.js'
console.log(rewrite('abc.less'));
//=> 'abc.css'

Explicitly pass an extension to use:

console.log(rewrite('foo/bar.txt', '.abc'));
//=> 'foo/bar.abc'

More examples

rewrite('abc.styl');    //=> 'abc.css'
rewrite('abc.sass');    //=> 'abc.css'
rewrite('abc.scss');    //=> 'abc.css'
rewrite('faux.css');    //=> 'faux.css'
rewrite('abc.swig');    //=> 'abc.html'
rewrite('abc.hbs');     //=> 'abc.html'
rewrite('abc.md');      //=> 'abc.html'
rewrite('abc.tmpl');    //=> 'abc.html'
rewrite('faux.html');   //=> 'faux.html'
rewrite('faux.coffee'); //=> 'faux.js'

About

  • file-normalize: File system utils for normalizing things like eol, encoding and BOM. | homepage
  • fs-utils: fs extras and utilities to extend the node.js file system module. Used in Assemble and… more | homepage
  • parse-filepath: Pollyfill for node.js path.parse, parses a filepath into an object. | homepage

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.

This file was generated by verb-generate-readme, v0.4.3, on March 22, 2017.

Keywords

dest

FAQs

Package last updated on 23 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.