twig - gulp-data results in empty html -
the views:build
task includes templates before data gets injected, resulting in blank html page. doing wrong?
this code:
gulp.task('views:build', ['views:templates'] , () => { return gulp.src(config.views.src + '*.twig') .pipe($.data(function() { return json.parse(fs.readfilesync('src/data/timber.json')) })) // load data base json file .pipe($.twig()) .pipe(gulp.dest(config.views.tmp)) .pipe(reload({stream: true})); }); gulp.task('views:templates', () => { return gulp.src(config.views.src + 'templates/*.twig') .pipe($.data(function(file) { return json.parse(fs.readfilesync('src/data/' + path.basename(file.path).replace('.twig', '') + '.json')); })) .pipe($.twig()) .pipe(gulp.dest(config.views.tmp)) });
Comments
Post a Comment