Created
March 14, 2016 17:43
-
-
Save stowball/f91f305cb825ea812cb1 to your computer and use it in GitHub Desktop.
trying to get twig data to work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 'use strict'; | |
| var path = require('path'); | |
| var gulp = require('gulp'); | |
| var conf = require('./conf'); | |
| var twig = require('gulp-twig'); | |
| var data = require('gulp-data'); | |
| var getJsonData = function(file) { | |
| var foo = path.join(conf.paths.builds, '/data/', path.basename(file.path.replace('twig.html', 'json'))); | |
| console.log(foo); | |
| return require(foo); | |
| }; | |
| gulp.task('twig-templates', function () { | |
| return gulp.src([ | |
| path.join(conf.paths.builds, '/*.twig.html') | |
| ]) | |
| .pipe(data(getJsonData)) | |
| .pipe(twig()) | |
| .pipe(gulp.dest(conf.paths.src)); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment