-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.js
More file actions
30 lines (24 loc) · 923 Bytes
/
example.js
File metadata and controls
30 lines (24 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
var file = require('./');
var generate = require('generate');
var app = generate({cli: true});
// app.option('silent', 'foo');
// 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'});
app.doc('baz', {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}));
app.on('dest', function(file, dest) {
file.extname = '.hbs';
file.dest = 'foo';
});
app.build(['foo', 'bar', 'baz'], function(err) {
if (err) return console.error(err);
app.emit('done', 'build');
});