I'm not much of a web developer yet. I want to create a local (yes, really offline) html/js (coffeescript/jade) app, using brunch. I would like to have some JSON files with data like
{
"title": "My title",
"content": "Lorem ipsum dolor..."
}
Now this data should be included in the app. I created a mixin:
mixin test_block(data)
h1 data.title
p data.content
How can I achieve this to keep the data separated from the mixin/jade code? The reason for this is: I don't need/want a db or aclient/server approach. I just want a completely local 5-pages-webpage, compiled into html and very few js. It must be placeable on a USB stick and run by clicking on the index.html.
I want to add new content by e.g. adding a new json file (e.g. welcome.json
) and placing a new mixin call into the jade file ( test_block(welcome)
)
Brunch does a nice job compiling/concatenating all the stuff into very few files. Bit I don't get how to fetch the data out of the json files.
Is there a better approach? Maybe the JSON thing is not the best one. But this content needs to be generated by other people, programmatically, from a database.
Thanks in advance.
Simple answer to anyone who need it: As far as I found out, it is not possible without using an e.g. backbone model. I ended using jade as wrapper:
personA = { firstname: "Tom", lastname: "Jones" }
and including that in another jade file