Question
I am new to haml and want to do some inheritance, but I don't know whether it is possible with haml or not.
I have 2 separate haml files as below
=== file1.haml
%p
This is haml1
=== file2.haml
%h1
This is haml2
*** I want to have a file.haml
which inherit from file1.haml
and file2.haml
.
Is it possible to do it with haml?
Solution
you could turn file1.haml and file2.haml to partials (i.e. _file1.haml, _file2.haml) then use the render function in file.haml, for example in file.haml:
%p
=render(:partial => "file1")
%p
=render(:partial => "file2")
OTHER TIPS
In my implementation it can, and the behavior just like Textmate did, you create some bundle of snipt code and use when you need it to make it DRY
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow