# gulp-extname [![NPM version](https://img.shields.io/npm/v/gulp-extname.svg)](https://www.npmjs.com/package/gulp-extname) [![Build Status](https://img.shields.io/travis/jonschlinkert/gulp-extname.svg)](https://travis-ci.org/jonschlinkert/gulp-extname) > gulp plugin to dynamically rewrite dest extensions based on src extensions. - [Install](#install) - [Usage](#usage) * [Define extension](#define-extension) - [Extension mappings](#extension-mappings) - [Related projects](#related-projects) - [Running tests](#running-tests) - [Contributing](#contributing) - [Author](#author) - [License](#license) _(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_ ## Install Install with [npm](https://www.npmjs.com/): ```sh $ npm i gulp-extname --save ``` ## Usage ```js var gulp = require('gulp'); var extname = require('gulp-extname'); gulp.task('default', function() { gulp.src('styles.less') .pipe(extname()) .pipe(gulp.dest('dist/css')); //=> dist/css/styles.css }); ``` ### Define extension Explicitly pass an extension to use. Any of these will work: ```js .pipe(extname('.foo')) // or .pipe(extname('foo')) // or .pipe(extname({ext: 'foo'})) ``` ## Extension mappings The following extensions are mapped automatically: ```js // html .md //=> .html .hbs //=> .html .swig //=> .html .tmpl //=> .html .html //=> .html .htm //=> .html // css .less //=> .css .styl //=> .css .sass //=> .css .scss //=> .css .css //=> .css // js .coffee//=> .js .js //=> .js ``` [Add extension mappings](https://github.com/jonschlinkert/ext-map), or use [rewrite-ext](https://github.com/jonschlinkert/rewrite-ext) for non-gulp projects. ## Related projects * [gulp-dest](https://www.npmjs.com/package/gulp-dest): Gulp plugin for easily defining destination paths using path variables. | [homepage](https://github.com/jonschlinkert/gulp-dest) * [gulp-format-md](https://www.npmjs.com/package/gulp-format-md): Gulp plugin for beautifying markdown using pretty-remarkable. | [homepage](https://github.com/jonschlinkert/gulp-format-md) * [gulp-htmlmin](https://www.npmjs.com/package/gulp-htmlmin): gulp plugin to minify HTML. | [homepage](https://github.com/jonschlinkert/gulp-htmlmin#readme) * [gulp-prettify](https://www.npmjs.com/package/gulp-prettify): Prettify, format, beautify HTML. | [homepage](https://github.com/jonschlinkert/gulp-prettify) * [gulp-routes](https://www.npmjs.com/package/gulp-routes): Add middleware to run for specified routes in your gulp pipeline. | [homepage](https://github.com/assemble/gulp-routes) ## Running tests Install dev dependencies: ```sh $ npm i -d && npm test ``` ## Contributing Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/gulp-extname/issues/new). ## Author **Jon Schlinkert** * [github/jonschlinkert](https://github.com/jonschlinkert) * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) ## License Copyright © 2016 [Jon Schlinkert](https://github.com/jonschlinkert) Released under the MIT license. *** _This file was generated by [verb](https://github.com/verbose/verb) on January 06, 2016._