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

Using Mustache Templating #84

Closed
dgdosen opened this issue Dec 28, 2011 · 1 comment
Closed

Using Mustache Templating #84

dgdosen opened this issue Dec 28, 2011 · 1 comment

Comments

@dgdosen
Copy link

dgdosen commented Dec 28, 2011

Is it possible to use mustache for templating in a backbone-rails solution? If so, is there any guidance on how to do that?

@jotto
Copy link

jotto commented Dec 29, 2011

if you require mustache.js in your JS files, then you can just do this in your view's render function:

render: function() {
  this.html(
    Mustache.to_html("template code as a string {some_attr_on_your_model}", this.model.toJSON())
  )
}

the harder part is writing separate JST mustache templates like backbone is already setup for with EJS. investigate https://github.com/sstephenson/ruby-ejs/ to see how you could do the same for mustache

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

3 participants