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

Get Templates #57

Open
martinpfeiffer opened this issue Oct 4, 2013 · 1 comment
Open

Get Templates #57

martinpfeiffer opened this issue Oct 4, 2013 · 1 comment

Comments

@martinpfeiffer
Copy link

Hey,

Is there a way to just get the template informations mu2 uses? Just resolve the partials and don't render any data to the template (and don't replace other mustache tags except partials)

Use case: Use the same templates on client and server. I have to find a way to deliver a partial free version of the templates to the client.

@raycmorgan
Copy link
Owner

Because partials can be recursive, you cannot expand the partial tags at compile time in Mustache. What Mu does is compile all the needed partials at compile time and references them in the cache during render time.

An simple example of a recursive template:

// person.html

<ul>
  {{#friends}}
    <li>
      {{>person.html}}
    </li>
  {{/friends}}
</ul>

Most client side Mustaches have a form of partials as well, I would try to figure out a way to send those down apart from the main template. Would having an easily accessible list of partial files that a template references be helpful? Something like: mu.whichPartials(compiledTemplateOrPath); // => ["foo.html", "bar.html"]

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