Skip to content

Instantly share code, notes, and snippets.

@jruz
Forked from janogarcia/haml_partials.haml
Last active August 29, 2015 14:05
Show Gist options
  • Save jruz/72a6d20e3b1cc2f7bec1 to your computer and use it in GitHub Desktop.
Save jruz/72a6d20e3b1cc2f7bec1 to your computer and use it in GitHub Desktop.
/ A simplistic way of loading and rendering HAML partials (header.haml, footer.haml, nav.haml... you name it) without Rails
/ Useful when using tools like LiveReload http://livereload.com/
/ but don't want to configure a web server just to use PHP include/require constructs (discussion http://help.livereload.com/discussions/questions/22-haml-partials)
/ It could be improved/simplified using a helper http://stackoverflow.com/questions/5436769/partial-haml-templating-in-ruby-without-rails/5436973#5436973
/ Check out the Jade version https://gist.github.com/2593727
%html
%body
%header
= Haml::Engine.new(File.read('/path/to/your/partial.haml')).render(Object.new,{local: 'value'})
%footer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment