{{#block "tasks"}} {%= headings(apidocs('generator.js')) %} {{/block}}
This generator returns a function that needs to be called, so you can pass an options object if you need to customize anything.
var file = require('{%= name %}');
var generate = require('generate');
var app = generate();
// create an arbitrary template collection, or use
// the built-in generic collection `templates`
app.create('docs');
// add some views (a task will be created using the filename
// of each view, so you can run `foo` to generate the `foo` file)
app.doc('foo', {content: 'this is an example template'});
app.doc('bar', {content: 'another example template'});
// pass the collection on `options.views`, or if nothing
// is passed the `templates` view collection will be used
app.use(file({views: app.views.docs}));
Defaults
The following example shows how to use a custom collection. See the API docs below for an example of how to use the built-in generic templates
collection.
var file = require('{%= name %}');
var generate = require('generate');
var app = generate();
// create an arbitrary template collection, or use
// the built-in generic collection `templates`
app.create('docs');
// add some views (a task will be created using the filename
// of each view, so you can run `foo` to generate the `foo` file)
app.doc('foo', {content: 'this is an example template'});
app.doc('bar', {content: 'another example template'});
// pass the collection on `options.views`, or if nothing
// is passed the `templates` view collection will be used
app.use(file({views: app.views.docs}));