awinogradov / bem-on-rails

BEM methodology for Rails applications
65 stars 7 forks source link

Add bem-compatible html code generator #13

Open installero opened 10 years ago

installero commented 10 years ago

It would be awesome to avoid retyping bem-prefix every time while writing code in haml/rhtml template. I wonder one can add a preprocessor or something to convert

<%= block name: 'user' do %>
  <div>
    <p class="_name">
      <%= user.name %>
    </p>
    <p class="_age">
      <%= user.age %>
    </p>
  </div>
<% end %>

into

<div class=”b-user”>
  <p class="b-user_name">
     <%= user.name %>
  </p>
  <p class="b-user_age">
    <%= user.age %>
  </p>
</div>
installero commented 10 years ago

Discussion: http://habrahabr.ru/post/192972/#comment_7822421

awinogradov commented 10 years ago

Awesome!

installero commented 10 years ago

I am not insisting on that very syntax for block generator, btw. It's just rough example.