Skip to content

Latest commit

 

History

History
100 lines (71 loc) · 2.3 KB

.verb.md

File metadata and controls

100 lines (71 loc) · 2.3 KB

{%= name %} {%= badge("fury") %} {%= badge("travis") %}

{%= description %}

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

{%= include("install-npm", {save: true}) %}

Usage

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

Ignore files using glob patterns

var gulp = require('gulp');
var drafts = require('{%= name %}');

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.)

var gulp = require('gulp');
var drafts = require('{%= name %}');

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

var gulp = require('gulp');
var drafts = require('{%= name %}');

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].

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:

node i -d && mocha

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue]({%= bugs.url %})

Author

{%= include("author") %}

License

{%= copyright() %} {%= license() %}


{%= include("footer") %}