Recently, I got to learn about HAML for supporting my
Rails Application and I found out some very interesting facts which I wanted to share with you guys. The learning experience was excellent and now I want to make sure the sharing experience is excellent too. Hope you will catch it easily!
Okay, so here we go and some very basic stuff about HAML would be, HAML stands for HTML Abstraction Markup Language. It is a new template engine for Ruby on Rails. It is a replacement for the RHTML templates which we are so used to in rails applications.
The principles of HAML are that the markup should be beautiful, markup should be DRY (Don’t Repeat Yourself) and markup should be indented. Hope this is not rocket science.
Rails “embedded Ruby” by default i.e., .erb files describe HTML output with some necessary Ruby code to generate the dynamic parts of a page. HAML does the same but it takes a minimalist approach when it comes to the syntax.
White space rules in HAML are very strict. Nesting is handled by indentation. In HAML the tags begin with % and there is no need to close them. They are self closed by indentation.
Read more on HAML @ Railscarma Blog
Rails Application and I found out some very interesting facts which I wanted to share with you guys. The learning experience was excellent and now I want to make sure the sharing experience is excellent too. Hope you will catch it easily!
Okay, so here we go and some very basic stuff about HAML would be, HAML stands for HTML Abstraction Markup Language. It is a new template engine for Ruby on Rails. It is a replacement for the RHTML templates which we are so used to in rails applications.
The principles of HAML are that the markup should be beautiful, markup should be DRY (Don’t Repeat Yourself) and markup should be indented. Hope this is not rocket science.
Rails “embedded Ruby” by default i.e., .erb files describe HTML output with some necessary Ruby code to generate the dynamic parts of a page. HAML does the same but it takes a minimalist approach when it comes to the syntax.
White space rules in HAML are very strict. Nesting is handled by indentation. In HAML the tags begin with % and there is no need to close them. They are self closed by indentation.
Read more on HAML @ Railscarma Blog