1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | var combiner = require('stream-combiner2');
|
8 | var merge = require('merge-stream');
|
9 |
|
10 | module.exports = function(gulp, $, conf, browserSync) {
|
11 |
|
12 |
|
13 | var swighljs = require('../config/swig_hljs.js');
|
14 | var swigLocals = conf.build.templateVars;
|
15 | var swigOptions = {
|
16 | defaults : { cache: false, locals: swigLocals },
|
17 | data : { page: {} },
|
18 | setup : function(swig) {
|
19 |
|
20 |
|
21 | swig.setExtension(swighljs.ext.name, swighljs.ext.obj);
|
22 | swig.setTag('highlight', swighljs.parse, swighljs.compile, swighljs.ends, swighljs.block);
|
23 | }
|
24 | }
|
25 |
|
26 | gulp.task('template', function() {
|
27 | var combined = combiner.obj([
|
28 | gulp.src(conf.parsePwd(conf.tmplFiles), { base: conf.parsePwd(conf.app) }),
|
29 | $.swig(swigOptions),
|
30 | gulp.dest(conf.parsePwd(conf.tmp)),
|
31 | browserSync.stream()
|
32 | ]);
|
33 |
|
34 | combined.on('error', console.error.bind(console));
|
35 |
|
36 | return combined;
|
37 | });
|
38 | }
|