Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different html file in vash by command #83

Closed
fghhfg opened this issue Jul 15, 2015 · 1 comment
Closed

different html file in vash by command #83

fghhfg opened this issue Jul 15, 2015 · 1 comment

Comments

@fghhfg
Copy link

fghhfg commented Jul 15, 2015

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???);
@fghhfg fghhfg closed this as completed Jul 15, 2015
@fghhfg fghhfg changed the title insert the contents of one vash file into another? different html file in vash Jul 16, 2015
@fghhfg fghhfg reopened this Jul 16, 2015
@fghhfg fghhfg changed the title different html file in vash different html file in vash by command Jul 16, 2015
@fghhfg fghhfg closed this as completed Jul 16, 2015
@fghhfg fghhfg reopened this Jul 16, 2015
@fghhfg fghhfg closed this as completed Jul 16, 2015
@kirbysayshi
Copy link
Owner

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'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants