different html file in vash by command
fghhfg opened this issue · 1 comments
fghhfg commented
With @model
in layout.vash
, I can use same layout(.vash) with diff contents(obj) by command:
// command
var tpl = vash.compile( layout.vash );
var out1 = tpl(content_obj1);
var out2 = tpl(content_obj2);
var out3 = tpl(content_obj3);
What if I want to use diff html
file in layout.vash
?
I want to use different file_name.html
(a.html, b.html, c.html) by command:
// layout.vash
...
@html.include(file_name.html, obj)
...
How to do that?
// command
var tpl = vash.compile( layout.vash );
var out1 = tpl(a.html???);
var out1 = tpl(b.html???);
var out1 = tpl(c.html???);
kirbysayshi commented
If you really wanted to do this, switch on something passed into the template:
@switch(name) {
case 'a':
@html.include('a.html')
break;
}
var out = tpl({name: 'a'})