-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
assemblefile.js
49 lines (42 loc) · 1.45 KB
/
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
49
'use strict';
var assemble = require('assemble');
var extname = require('gulp-extname');
var path = require('path');
var browserSync = require('browser-sync').create();
var helpers = require('handlebars-helpers');
var compare = helpers.comparison();
var pkg = require('./package');
var app = assemble();
app.task('init', function(cb) {
app.helper('md', require('helper-md').sync);
app.helper('is', compare);
app.helper('markdown', require('helper-markdown'));
app.data('pkg', pkg);
app.data('dist', 'dist');
app.data(['./src/templates/data/**/*.{json,yml}']);
// app.data('analytic','UA-23581568-13');
app.layouts(path.join(__dirname, './src/templates/layouts/*.hbs'));
app.partials(path.join(__dirname, './src/templates/partials/**/*.hbs'));
app.pages(path.join(__dirname, './src/templates/pages/*.hbs'));
app.option('layout', 'default');
cb();
});
app.task('html:rtl', ['init'], function() {
app.data('assets', '../assets');
app.data('rtl', true);
return app.toStream('pages')
.pipe(app.renderFile())
.pipe(extname())
.pipe(app.dest('public/rtl'))
.pipe(browserSync.stream());
});
app.task('html', ['init'], function() {
app.data('assets', 'assets');
return app.toStream('pages')
.pipe(app.renderFile())
.pipe(extname())
.pipe(app.dest('public'))
.pipe(browserSync.stream());
});
app.task('default', ['html', 'html:rtl']);
module.exports = app;