-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
34 lines (31 loc) · 1.04 KB
/
gulpfile.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
"use strict";
const gulp = require('gulp');
const twig = require('gulp-twig');
const data = require('gulp-data');
const fs = require('fs');
// Compile Twig templates to HTML
gulp.task('templates', function() {
return gulp.src(['./templates/**/*.twig', '!templates/_*.twig', '!templates/base.html.twig'], { dot: true })
.pipe(data(function(file) {
return JSON.parse(fs.readFileSync('./data/set.json'));
}))
.pipe(twig({
errorLogToConsole: true,
extname: false,
filters: [
{
name: "mb_split",
func: function (args) {
return [...args];
}
},
{
name: "u",
func: function (args) {
return args.codePointAt(0).toString(16).padStart(4, '0');
}
}
]
}))
.pipe(gulp.dest('./')); // output the rendered files to the "dist" directory
});