Answer the question
In order to leave comments, you need to log in
How to use json data in jade ?
Hello,
does anyone have an example of using data from a json file in jade?
compiled via gulp
Answer the question
In order to leave comments, you need to log in
See my example: https://github.com/kulakowka/kulakowka.com/blob/ma...
Specifically, in this place. The config variable is passed to the jade template engine.
// Templates
gulp.task('templates', function() {
var config = {
revision: new Date().getTime()
};
gulp.src('./assets/views/**/*.jade')
.pipe(jade({
locals: config
}))
.pipe(gulp.dest('./public/'))
.pipe(notify({ message: 'Templates task complete' }));
});
// Templates
gulp.task('templates', function() {
var config = require('./config.json');
gulp.src('./assets/views/**/*.jade')
.pipe(jade({
locals: config
}))
.pipe(gulp.dest('./public/'))
.pipe(notify({ message: 'Templates task complete' }));
});
{
"param1":"мои данные 1",
"param2":"мои данные 2"
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question