views:

280

answers:

2

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?

+5  A: 

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")
paolo granada lim
+1 partials are the rails way of doing this kind of stuff.
Sam Saffron
A: 

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

wharsojo