Skip to content

Instantly share code, notes, and snippets.

@heycarsten
Forked from chriseppstein/mixins.haml
Created July 27, 2010 23:13
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 heycarsten/493034 to your computer and use it in GitHub Desktop.
Save heycarsten/493034 to your computer and use it in GitHub Desktop.
# I was thinking about it, and thought if you were going to do "mixins" in Haml
# then they ought to work in a predictable way. In ERB you can simply define a
# method and place more ERB inside of it. This does not work in Haml, but maybe
# it should.
require 'sinatra'
require 'haml'
get '/erb' do
erb :test_erb
end
get '/haml' do
haml :test_haml
end
__END__
@@ test_erb
<% def hello(name) %>
<p>Hello, <%= name %>.</p>
<% end %>
<% hello 'Carsten' %>
@@ test_haml
-# This will fail.
- def hello(name)
%p Hello, #{name}.
- hello 'Carsten'
@chriseppstein
Copy link

interesting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment