-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
38 lines (33 loc) · 1.19 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
35
36
37
38
"use strict";
const gulp = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const twig = require('gulp-twig');
const data = require('gulp-data');
const yaml = require('gulp-yaml');
const fs = require('fs');
gulp.task('style', function () {
return gulp.src('./sass/**/*.scss')
.pipe(sass({includePaths: ['node_modules'], outputStyle: 'expanded'}))
.pipe(gulp.dest('./new'));
});
// 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: "u",
func: function (args) {
return args.codePointAt(0).toString(16).padStart(4, '0');
}
}
]
}))
.pipe(gulp.dest('./new')); // output the rendered files to the "dist" directory
});
gulp.task('default', gulp.series('style', 'templates'));