# 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.

Latest version **1.0.0** (published 2017-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install rewrite-ext
pnpm add rewrite-ext
yarn add rewrite-ext
bun add rewrite-ext
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-03-23 |
| First published | 2014-11-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | dest, ext, extensions, extname, file, filename, filepath, fp, fs, gulpfriendly, map, path, rewrite, src |

## Links

- npm: https://www.npmjs.com/package/rewrite-ext
- Repository: https://github.com/jonschlinkert/rewrite-ext
- Issues: https://github.com/jonschlinkert/rewrite-ext/issues
- npm.io page: https://npm.io/package/rewrite-ext

## Dependencies (2)

- [ext-map](https://npm.io/package/ext-map.md) ^1.0.1
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-03-23
- 0.2.0 — 2015-02-22
- 0.1.0 — 2014-11-13

## README

# rewrite-ext [![NPM version](https://img.shields.io/npm/v/rewrite-ext.svg?style=flat)](https://www.npmjs.com/package/rewrite-ext) [![NPM monthly downloads](https://img.shields.io/npm/dm/rewrite-ext.svg?style=flat)](https://npmjs.org/package/rewrite-ext)  [![NPM total downloads](https://img.shields.io/npm/dt/rewrite-ext.svg?style=flat)](https://npmjs.org/package/rewrite-ext) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/rewrite-ext.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/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

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save rewrite-ext
```

## Usage

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

Automatically re-write extensions to the mapped extensions from [ext-map](https://github.com/jonschlinkert/ext-map):

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

Explicitly pass an extension to use:

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

## More examples

```js
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

### Related projects

* [file-normalize](https://www.npmjs.com/package/file-normalize): File system utils for normalizing things like eol, encoding and BOM.  | [homepage](https://github.com/jonschlinkert/file-normalize "File system utils for normalizing things like eol, encoding and BOM. ")
* [fs-utils](https://www.npmjs.com/package/fs-utils): fs extras and utilities to extend the node.js file system module. Used in Assemble and… [more](https://github.com/assemble/fs-utils) | [homepage](https://github.com/assemble/fs-utils "fs extras and utilities to extend the node.js file system module. Used in Assemble and many other projects.")
* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Pollyfill for node.js `path.parse`, parses a filepath into an object. | [homepage](https://github.com/jonschlinkert/parse-filepath "Pollyfill for node.js `path.parse`, parses a filepath into an object.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ 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:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.4.3, on March 22, 2017._

---
_Source: https://npm.io/package/rewrite-ext · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
