Output for blocks with the commandline tool or compile API
Closed this issue · 2 comments
thcgit commented
Using the example for vash.helpers.append:
// layout.vash
<ul>
@html.block('main-nav', function(model){
<li><a href="/">Home</a></li>
})
</ul>
// another.vash
@html.extend('layout.vash', function(model){
@html.append('main-nav', function(){
<li><a href="/another">Another Link</a></li>
})
})
If I run the commandline tool:
node_modules\.bin\vash --file="another.vash" --out="." --render
Instead of the expected
<ul>
<li><a href="/">Home</a></li>
<li><a href="/another">Another Link</a></li>
</ul>
the output I get is:
<ul>
[VASHMARK-8947656:block-main-nav]
</ul>
If I use the vash.compile API or the WebPack render-template-loader to load the template (which is what I'm mainly trying to use vash for), I get the same output that contains VASHMARK.
Is there something I'm missing?
kirbysayshi commented
Yes, you need to pass a function as the final argument to the render
function. This is only necessary when using the layout helpers. Something
like:
tpl(model, function(ctx){ ctx.finishLayout() })
https://github.com/kirbysayshi/vash/blob/master/README.md#onrenderend
…On Wed, May 9, 2018 at 12:00 AM thcgit ***@***.***> wrote:
Using the example for vash.helpers.append:
// layout.vash
<ul>
@html.block('main-nav', function(model){
<li><a href="/">Home</a></li>
})
</ul>
// another.vash
@html.extend('layout.vash', function(model){
@html.append('main-nav', function(){
<li><a href="/another">Another Link</a></li>
})
})
If I run the commandline tool:
node_modules\.bin\vash --file="another.vash" --out="." --render
Instead of the expected
<ul>
<li><a href="/">Home</a></li>
<li><a href="/another">Another Link</a></li>
</ul>
the output I get is:
<ul>
[VASHMARK-8947656:block-main-nav]
</ul>
If I use the vash.compile API or the WebPack render-template-loader to
load the template (which is what I'm mainly trying to use vash for), I get
the same output that contains VASHMARK.
Is there something I'm missing?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#125>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAFiz5piy3IHXJQWO2d1z9rywO2QqLQhks5twmnugaJpZM4T3rPz>
.
thcgit commented
That was it. Thanks so much!