verb

Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API docs to a readme, for projects big or small.

verb

Documentation generator for GitHub projects. Extremely powerful, easy to use, can generate anything from API docs to a readme, for projects big or small.

Verb is the most powerful, extensible and easy-to-use documentation generator for node.js.

Heads up!

As of v0.4.0, Verb now requires verb-cli to run. See the getting started section for details.

It's magical and smells like chocolate. If that's not enough for you, it's also the most powerful and easy-to-use documentation generator for node.js. And it's magical.

Features

  • Generate markdown docs, or HTML
  • Generate a Table of Contents simply by adding <!-- toc --> to any document.
  • Include templates from locally installed npm packages with the {%= include() %} helper
  • Include templates from your project's docs/ directory with the {%= docs() %} helper
  • Change the templates directory for either helper by passing a cwd to the helper: example: {%= docs("foo", {cwd: ''}) %}

Install with npm

npm i verb --save
var verb = require('verb');

.src

Glob patterns or filepaths to source files.

Example usage

Params

  • glob {String|Array}: Glob patterns or file paths to source files.
  • options {Object}: Options or locals to merge into the context and/or pass to src plugins

Examples

verb.src('src/*.hbs', {layout: 'default'})
verb.task('site', function() {
  verb.src('src/*.hbs', {layout: 'default'})
    verb.dest('dist')
});

.dest

Specify a destination for processed files.

Example usage

Params

  • dest {String|Function}: File path or rename function.
  • options {Object}: Options or locals to merge into the context and/or pass to dest plugins

Examples

verb.dest('dist', {ext: '.xml'})
verb.task('sitemap', function() {
  verb.src('src/*.txt')
    verb.dest('dist', {ext: '.xml'})
});

.copy

Copy a glob of files to the specified dest.

Params

  • glob {String|Array}
  • dest {String|Function}
  • returns {Stream}: Stream, to continue processing if necessary.

Example

verb.task('assets', function() {
  verb.copy('assets/**', 'dist');
});

.task

Define a Verb task.

Params

  • name {String}
  • fn {Function}

Example

verb.task('docs', function() {
  verb.src(['.verb.md', 'docs/*.md'])
    .pipe(verb.dest('./'));
});

.gettask

Get the id from the current task. Used in plugins to get the current session.

  • returns {String} task: The currently running task.

Example

var id = verb.gettask();
verb.views[id];

.getFile

Used in plugins to get a template from the current session.

  • returns {String} id: Pass the task-id from the current session.
  • returns {Object} file: Vinyl file object. Must have an id property that matches the id of the session.

Example

var template = getFile(id, file);

.taskFiles

taskFiles is a session-context-specific getter that returns the collection of files from the current task.

  • returns {Object}: Get the files from the current task.

Example

var files = verb.taskFiles;

.watch

Re-run the specified task(s) when a file changes.

Params

  • glob {String|Array}: Filepaths or glob patterns.
  • fn {Function}: Task(s) to watch.

Example

verb.task('watch', function() {
  verb.watch('docs/*.md', ['docs']);
});

Install dev dependencies:

npm i -d && npm test

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Jon Schlinkert

Copyright (c) 2014-2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on April 25, 2015.