-
Notifications
You must be signed in to change notification settings - Fork 1
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
require('file.vash') from within a template? #7
Comments
oh interesting! Once I find the require statement then it is easy. However, I'm not sure how I'd go about getting all the code blocks from a vash file. Does vash have something I can use to examine the code blocks from a template? |
Not easily, since vash's ast is very generic (mostly code vs markup). What ~ Drew On May 9, 2014, at 8:17 AM, Mike Chevett notifications@github.com wrote: oh interesting! Once I find the require statement then it is easy. However, — |
oic. I believe that's what I'm already doing and I think I can see what needs to change. I'll take a stab at it this weekend and let you know! |
Cool! Yip yip, On Fri, May 9, 2014 at 10:33 AM, Mike Chevett notifications@github.comwrote:
|
#7 require('file.vash') from within a template
Any idea if this has been working? Can this be closed? |
Sorry it took me so long. Yes, it appears to be working! It also revealed a miscalculation on my part. This is what's required to make it work, since now the templates do not share a rendering context: @* list.vash *@
@{ var item = require('./list-item.vash'); }
<ul>@html.raw(model.map(item))</ul> As you can see, the return value of the rendering template is needed to be output (via map) and told to not be html escaped. While this makes sense technically, it's a little weird. Still, it works for now. But either way, your patch looks great! |
nice! Keep these kind of things coming. closing. |
How hard do you think it would be to add support for:
Otherwise, are you constructing templates from the inside out and then passing them in, fully rendered?
I tried the above snippet, but since it's a physical temp file on disk it doesn't resolve:
The text was updated successfully, but these errors were encountered: