Answer the question
In order to leave comments, you need to log in
How to pass variables to sass from json file using gulp collector?
This is how I do with variables in json + twig (wish something like this)
"page": {
"view": "mockup",
"bg": "gradient",
"buttons": "two"
},
gulp.task('twig', function() {
return gulp.src('app/**/*.twig').
pipe(data(function(file) {
return JSON.parse(fs.readFileSync('app/options.json'));
})).
pipe(twig()).
pipe(gulp.dest('public'));
});
{% include "layouts/contents/" ~ page.view ~ ".twig" %}
Answer the question
In order to leave comments, you need to log in
In case anyone stumbles, here is the solution from my own stackoverflow question.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question