Silverdot

This is providing to convert .html.erb to .html.ejs for embossing into your rails templates.

Basic usage

in comments/_item.html.erb

  <li>
    <strong><%= comment.user.name %></strong>
    <p><%= comment.body %></p>
  </li>

in comments/show.html.erb

  <ul>
    <% @comments.each do |comment| %>
      <%= render 'item', comment: comment %>
    <% end %>
  </ul>
  <script type="text/template">
    <%= emboss 'item', with: :comment %>
  </script>

render with @comments = []

  <ul>
  </ul>
  <script type="text/template">
    <li>
      <strong>{{ comment.user.name }}</strong>
      <p>{{ comment.body }}</p>
    <li>
  </script>

Use image_tag

  <%= image_tag sample %>
  <img src="{{ sample.src }}" alt="{{ sample.alt }}">

Emboss EJS Template

  <%= emboss 'single', with: :single, jst: true %>
  <script>(function() { JST || (JST = {}); JST['single'] = function(obj){var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('<p>',  single ,'</p>\n');}return __p.join('');};}).call(this);</script>

JST['single'] is compiled javascript template.