Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Shared Templates for Rails 3 - lightning talk b...

Shared Templates for Rails 3 - lightning talk by Alexey Vasiliev at EuRuKo

Railsware

June 19, 2012
Tweet

More Decks by Railsware

Other Decks in Programming

Transcript

  1. Ways to render web interface • Rails renders content on

    backend and sends it to browser • Rails backend has only REST API and interface renders by JavaScript in web application
  2. Hybrid web application • Interface partially rendered on backend and

    partially on frontend • It is needed to use the same templates for backend and frontend quite often • We need DRY!
  3. smt_rails • smt_rails (Shared Mustache Templates for Rails 3) •

    gem 'smt_rails' • rails g smt_rails:install • You're done!
  4. Example Template: Hello {{msg}}!!! ActionView: <%= render "tests/test", :mustache =>

    {msg: "Test"} %> JavaScript: var content = SMT['tests/test']({msg: "Test"});
  5. sht_rails • sht_rails (Shared Handlebars Templates for Rails 3) •

    Built for people who likes handlebars.js :)