# gulp-dest-router

> routes files in different directories in gulp task

Latest version **0.1.2** (published 2016-10-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-dest-router
pnpm add gulp-dest-router
yarn add gulp-dest-router
bun add gulp-dest-router
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2016-10-17 |
| First published | 2016-10-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Aleksandr Kalinin |
| Maintainers | kalinaa |
| Keywords | dest, router, routes, gulp, plugin |

## Links

- npm: https://www.npmjs.com/package/gulp-dest-router
- Repository: https://github.com/kalinaa/gulp-dest-router
- Homepage: https://github.com/kalinaa/gulp-dest-router#readme
- Issues: https://github.com/kalinaa/gulp-dest-router/issues
- npm.io page: https://npm.io/package/gulp-dest-router

## Dependencies (2)

- [fs-extra](https://npm.io/package/fs-extra.md) ^0.30.0
- [through2](https://npm.io/package/through2.md) ^2.0.1

## Alternatives

- [express-promise-router](https://npm.io/package/express-promise-router.md) — 736.1K weekly downloads
- [next-usequerystate](https://npm.io/package/next-usequerystate.md) — 29.8K weekly downloads
- [@bitkyc08/opencodex](https://npm.io/package/@bitkyc08/opencodex.md) — 4.6K weekly downloads
- [lynkr](https://npm.io/package/lynkr.md) — 575 weekly downloads
- [baremetal.js](https://npm.io/package/baremetal.js.md) — 42 weekly downloads

## Recent versions

- 0.1.2 (latest) — 2016-10-17
- 0.1.1 — 2016-10-17
- 0.1.0 — 2016-10-16

## README

# Install

```
npm install gulp-dest-router --save-dev
```

# Basic Usage

You can use routes to build your files in different directories.
Like this:

```javascript
'use strict';

var destRouter = require('gulp-dest-router');

gulp.task('copy:static', function () {
    gulp.src([
               './index.html',
               './static/images/*.png'  //if you use '*' in path, you must use exact relative path
             ])                           //to the file in router
        .pipe(destRouter({
            dest:'./build/assets',      //default destination path for all files
            routes:{
                'index.html': '../',    //for index.html dest path is one level up from default dest path
                'vk.png':'icons'        //for ./static/images/vk.png file dest path is ./build/assets/icons,
                '*': 'other_folder'     //for all other files (use '*' symbol)
            }                             //in ./static/images/ dest path is ./build/assets/other_folder
        }));
})
```

> if `*` is not defined, all files will be copied to default destination path.
> gulp-dest-router is not able to handle entire folder, like `path/to/include/**`

Also you can use it instead of gulp.dest
```javascript
'use strict';

var destRouter = require('gulp-dest-router');

gulp.task('styles', function () {
    gulp.src('*.css')
        .pipe(destRouter('styles'));      // copy all .css files to 'styles' directory
})
```

## Options

- `dest`

	`String` Required.
	Default destination path for all files.

- `routes`

	`Object`
	Optional setting. If it is passed, all files will be copied to default dest path.
	Use `*` for all files.

	```javascript
	{
	    'relativePath/to/srcFile': 'dest/path'
	}
	```
	> relative path from source path, which was defined in gulp.src()

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