HAML Inheritance

I'm new to haml and want to do some inheritance, but I don't know if this is possible with haml or not.

I have two separate haml files as shown below

=== file1.haml

%p

  This is haml1


=== file2.haml

%h1

  This is haml2

*** I want to have file.hamlthat inherit from file1.hamland file2.haml.

Can this be done with haml?

+3
source share
2 answers

you can rotate the file1.haml and file2.haml files into partials (for example, _file1.haml, _file2.haml), and then use the render function in the .haml file, for example in the .haml file:

%p
  =render(:partial => "file1")
%p
  =render(:partial => "file2")
+7
source

, , Textmate, snipt ,

0

Source: https://habr.com/ru/post/1717310/


All Articles