Ads Top

What is haml

What is haml example?

Haml stands for the "HTML Abstraction Markup Language" is a templating system for Ruby on Rails. Basically, it's designed for the HTML code cleaner and avoid writing inline code. Haml provides the flexible code for the dynamic content in HTML. Haml prefers only ASCII encodings UTF-8.

How to start Haml: it's required Ruby installation. After then will go to in the cmd(command prompt) install haml.

gem install haml

>> How to check the version of the haml: use command line
haml -v

Now you will go to your system folder and create a file as anything.haml and write something code in haml format.

For example You will use any editor as like notepad++ or something else. Take a new file and save anything.haml and copy paste haml code from the given below:
.testClass lorem ipsum.

D:\other\haml
D:\other\haml\haml filename.haml
D:\other\haml\haml anything.haml

You will revcieve code in the html format as following:
<div class="testClass">Lorem ipsum.</div>

It was a simple way. Here is the available another way:

D:\other\haml\haml anything.haml to html

The result will get a filename "to" (You can give anything name as you want) that where is your anything.haml file saved in the folder. You will show html code now compiled when the file will be open on any editor. Also, I am attaching an image for the more clarify.

No comments:

Copyright Reserved to Anything Learn. Powered by Blogger.