I trying to get the layout and content in separate files in express.js without using systems rendering engine (barebones hogan)
I have layout.html and index.html but i don't know how to properly make it.
Here are my files:
layout.html
{{> header}}
{{$content}}
default content
{{/content}}
{{> footer}}
index.html
{{<layout}}
{{$content}}
your content goes here
{{/content}}
{{/layout}}
and my script
var layout;
fs.readFile('layout.html','utf-8',function (err,view) {
layout = view;
});
fs.readFile('index.html','utf-8',function (err,view) {
var content = Hogan.compile(view);
var t = Hogan.compile(layout);
var s = t.render({},{'content':content});
res.send(s);
});
I get only layout default value and not content values.
I found it.