javascript - How to access data passed to the jade during compilation? -
here code i've written in gruntfile.js
pass json
file jade.
compile: { files: { // files }, options: { pretty: true, // passing .json file data jade data: grunt.file.readjson("./src/jade/config.json") }
how access data in .jade files? i've looked around couldn't found solution.
the data pass map of key-value pairs. can use jade syntax use values associated key names.
for instance, if data be:
{ "key1": "value1", "key2": "value2" }
then following template:
div= key1 div text #{key2}
would render:
<div>value1</div> <div>some text value2</div>
the reference in jade documentation, in string interpolation chapter.
Comments
Post a Comment