gulp-choose-files
Version:
Gulp plugin that prompts you to choose the files to pass through the stream.
116 lines (76 loc) • 3.92 kB
Markdown
> Gulp plugin that prompts you to choose the files to pass through the stream.
Install with [npm](https://www.npmjs.com/):
```sh
$ npm install --save gulp-choose-files
```
Install with [yarn](https://yarnpkg.com):
```sh
$ yarn add gulp-choose-files
```

```js
var gulp = require('gulp');
var choose = require('gulp-choose-files');
gulp.task('default', function() {
return gulp.src('fixtures/*.*')
.pipe(choose())
.pipe(gulp.dest('actual'));
});
```
**Type**: `string`
**Default**: `relative`
Specify the [vinyl](https://github.com/gulpjs/vinyl) `file` property to use when displaying file names in the choices array.
**Examples**
Given the file path `/dev/fixtures/foo.txt` (depending on cwd and `file.base`), here is what you would get:
```js
choose({key: 'path'});
//=> '/dev/fixtures/foo.txt'
choose({key: 'relative'});
//=> 'fixtures/foo.txt'
choose({key: 'basename'});
//=> 'foo.txt'
choose({key: 'stem'});
//=> 'foo'
```
If you need to be able to automatically skip the prompt, you can pass a string or array with your "choices" to `options.choices`.
The following will only write `a.txt`:
```js
gulp.task('default', function() {
return gulp.src('fixtures/*.txt')
.pipe(choose({choices: ['a.txt']}))
.pipe(gulp.dest('actual'));
});
```
* [gulp-choose-file](https://www.npmjs.com/package/gulp-choose-file): Gulp plugin that prompts you to choose a file to pass through the stream. | [homepage](https://github.com/pointnet/gulp-choose-file "Gulp plugin that prompts you to choose a file to pass through the stream.")
* [gulp-condense](https://www.npmjs.com/package/gulp-condense): Remove extra newlines in a string. | [homepage](https://github.com/jonschlinkert/gulp-condense "Remove extra newlines in a string.")
* [gulp-extname](https://www.npmjs.com/package/gulp-extname): gulp plugin to dynamically rewrite dest extensions based on src extensions. | [homepage](https://github.com/jonschlinkert/gulp-extname "gulp plugin to dynamically rewrite dest extensions based on src extensions.")
* [gulp-htmlmin](https://www.npmjs.com/package/gulp-htmlmin): gulp plugin to minify HTML. | [homepage](https://github.com/jonschlinkert/gulp-htmlmin#readme "gulp plugin to minify HTML.")
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
_(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
```
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
```
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
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.6.0, on April 28, 2017._