2016-11-03 01:33:53 +01:00
|
|
|
<p align="center">
|
|
|
|
<a href="http://gulpjs.com">
|
|
|
|
<img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
|
|
|
|
</a>
|
|
|
|
</p>
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
# replace-ext
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
Replaces a file extension with another one.
|
2016-10-10 03:43:44 +02:00
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
```js
|
2016-10-10 03:43:44 +02:00
|
|
|
var replaceExt = require('replace-ext');
|
|
|
|
|
|
|
|
var path = '/some/dir/file.js';
|
2016-11-03 01:33:53 +01:00
|
|
|
var newPath = replaceExt(path, '.coffee');
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
console.log(newPath); // /some/dir/file.coffee
|
2016-10-10 03:43:44 +02:00
|
|
|
```
|
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
## API
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
### `replaceExt(path, extension)`
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
Replaces the extension from `path` with `extension` and returns the updated path string.
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
Does not replace the extension if `path` is not a string or is empty.
|
2016-10-10 03:43:44 +02:00
|
|
|
|
2016-11-03 01:33:53 +01:00
|
|
|
## License
|
|
|
|
|
|
|
|
MIT
|
|
|
|
|
|
|
|
[downloads-image]: http://img.shields.io/npm/dm/replace-ext.svg
|
|
|
|
[npm-url]: https://www.npmjs.com/package/replace-ext
|
|
|
|
[npm-image]: http://img.shields.io/npm/v/replace-ext.svg
|
|
|
|
|
|
|
|
[travis-url]: https://travis-ci.org/gulpjs/replace-ext
|
|
|
|
[travis-image]: http://img.shields.io/travis/gulpjs/replace-ext.svg?label=travis-ci
|
|
|
|
|
|
|
|
[appveyor-url]: https://ci.appveyor.com/project/gulpjs/replace-ext
|
|
|
|
[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/replace-ext.svg?label=appveyor
|
|
|
|
|
|
|
|
[coveralls-url]: https://coveralls.io/r/gulpjs/replace-ext
|
|
|
|
[coveralls-image]: http://img.shields.io/coveralls/gulpjs/replace-ext/master.svg
|
|
|
|
|
|
|
|
[gitter-url]: https://gitter.im/gulpjs/gulp
|
|
|
|
[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg
|