Skip to content

Instantly share code, notes, and snippets.

@Johnius
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Johnius/f4b3dbf7d01d10382ef5 to your computer and use it in GitHub Desktop.
Save Johnius/f4b3dbf7d01d10382ef5 to your computer and use it in GitHub Desktop.
BEM true-way for Haml
/views/blocks/header.haml
- b 'header', attrs: { title: "Header title" } do |b|
- e 'title', tag: 'h1', content: 'Title example'
- e 'subtitle', tag: 'h3', content: 'Subtitle here'
/views/index.haml
= b 'header'
/ Result
.b-header{title: "Header title"}
%h1.b-header__title Title example
%h3.b-header__subtitle Subtitle here
/views/test.haml
= b 'header'
= e 'title' do
= 'test'
/Result
.b-header{title: "Header title", onClick: "javascript:void(0)"}
%h1.b-header__title test
%h3.b-header__subtitle Subtitle here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment