-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathassemblefile.js
48 lines (38 loc) · 886 Bytes
/
assemblefile.js
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
var choose = require('./');
var assemble = require('assemble');
var app = assemble();
/**
* Basic
*/
app.task('default', function() {
return app.src('fixtures/*.*')
.pipe(choose())
.pipe(app.dest('actual'));
});
/**
* Render templates
*/
app.task('render', function() {
app.engine('hbs', require('engine-handlebars'));
app.data({title: 'Assemble'});
return app.src('fixtures/*.*')
.pipe(choose())
.pipe(app.renderFile('hbs'))
.pipe(app.dest('actual'));
});
/**
* Choose files loaded from a collection (instead of fs)
*/
app.task('pages', function() {
app.pages('foo', {content: 'this is foo'});
app.pages('bar', {content: 'this is bar'});
app.pages('baz', {content: 'this is baz'});
return app.toStream('pages')
.pipe(choose())
.pipe(app.dest('actual'));
});
/**
* Expose the instance
*/
module.exports = app;