# gulp-drafts

> Gulp plugin for removing files flagged as drafts. Can also be used as an assemble or verb plugin.

Latest version **0.2.0** (published 2015-03-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-drafts
pnpm add gulp-drafts
yarn add gulp-drafts
bun add gulp-drafts
```

## 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.2.0 |
| Published | 2015-03-22 |
| First published | 2014-12-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | assemble, assembleplugin, blog, draft, drafts, gulpplugin, post, template, verb, verbplugin |

## Links

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

## Dependencies (4)

- [kind-of](https://npm.io/package/kind-of.md) ^1.1.0
- [through2](https://npm.io/package/through2.md) ^0.6.3
- [get-first](https://npm.io/package/get-first.md) ^0.1.1
- [micromatch](https://npm.io/package/micromatch.md) ^2.1.0

## Alternatives

- [cli-color](https://npm.io/package/cli-color.md) — 3.4M weekly downloads
- [log](https://npm.io/package/log.md) — 1.3M weekly downloads
- [logstash-client](https://npm.io/package/logstash-client.md) — 4.5K weekly downloads
- [@nocobase/plugin-logger](https://npm.io/package/@nocobase/plugin-logger.md) — 2.0K weekly downloads
- [child-process-debug](https://npm.io/package/child-process-debug.md) — 695 weekly downloads

## Recent versions

- 0.2.0 (latest) — 2015-03-22
- 0.1.0 — 2014-12-20

## README

# gulp-drafts [![NPM version](https://badge.fury.io/js/gulp-drafts.svg)](http://badge.fury.io/js/gulp-drafts)  [![Build Status](https://travis-ci.org/jonschlinkert/gulp-drafts.svg)](https://travis-ci.org/jonschlinkert/gulp-drafts) 

> Gulp plugin for removing files flagged as drafts. Can also be used as an assemble or verb plugin.

The filtering part of the plugin was inspired by [gulp-filter].

## Install with [npm](npmjs.org)

```bash
npm i gulp-drafts --save
```

## Usage

_All of the following examples should work in any combination with one another._

### Ignore files using glob patterns

```js
var gulp = require('gulp');
var drafts = require('gulp-drafts');

gulp.task('blog', function () {
  gulp.src('posts/**/*.md')
    // remove files from the pipeline if they match the given
    // filepath or glob patterns:
    .pipe(drafts('**/drafts/*.md'))
    .pipe(gulp.dest('dist'));
});
```

### Ignore files with the `draft` property

The plugin automatically filters out files with the `draft` or `data.draft` property set to `true`. Files won't have these properties unless you're setting them on the file object earlier in the pipeline. (_Or, if you're using this plugin with [assemble] or [verb] you can define the `draft` property in front-matter._)

```js
var gulp = require('gulp');
var drafts = require('gulp-drafts');

gulp.task('blog', function () {
  gulp.src('posts/**/*.md')
    // files with {draft: true} or {data: {draft: true}}
    // will be removed
    .pipe(drafts())
    .pipe(gulp.dest('dist'));
});
```

### Ignore files with custom properties

```js
var gulp = require('gulp');
var drafts = require('gulp-drafts');

gulp.task('blog', function () {
  gulp.src('posts/**/*.md')
    // ignore files with the `{foo: ...}` or `{bar: {baz: ...}}`
    // properties
    .pipe(drafts({props: ['foo', 'bar.baz']}))
    .pipe(gulp.dest('dist'));
});
```

### Verb example

Everything works the same with [verb] and [assemble].

```js
var verb = require('verb');
var drafts = require('verb-drafts');

verb.task('blog', function () {
  verb.src('posts/**/*.md')
    // ignore files with the `{foo: ...}` or `{bar: {baz: ...}}`
    // properties
    .pipe(drafts({props: ['foo', 'bar.baz']}))
    .pipe(verb.dest('dist'));
});
```


## Run tests

Install dev dependencies:

```bash
node i -d && mocha
```

## Contributing
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/gulp-drafts/issues)

## Author

**Jon Schlinkert**
 
+ [github/jonschlinkert](https://github.com/jonschlinkert)
+ [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 

## License
Copyright (c) 2015 Jon Schlinkert  
Released under the MIT license

***

_This file was generated by [verb-cli](https://github.com/assemble/verb-cli) on March 22, 2015._

[gulp-filter]: https://github.com/sindresorhus/gulp-filter

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