Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HAML vs Zen Coding [closed]

Tags:

html

haml

I read about both HAML vs Zen Coding. Both can save time in typing HTML.

Which would be good to use and why?

like image 230
Jitendra Vyas Avatar asked Dec 16 '22 03:12

Jitendra Vyas


2 Answers

One can actually use Zen Coding to produce HAML.

Example:

#main.with-shadow>h1.title+h2.subtitle+p

Will produce, by default:

<div id="main" class="with-shadow">
    <h1 class="title"></h1>
    <h2 class="subtitle"></h2>
    <p></p>
</div>

If you would like that statement to expand to HAML, append "|haml" to your abbreviation:

#main.with-shadow>h1.title+h2.subtitle+p|haml

That should give you the following:

#main.with-shadow
    %h1.title
    %h2.subtitle
    %p

Read here to learn more about filters for the Zen Coding expansions.

like image 143
marothstein Avatar answered Jan 12 '23 16:01

marothstein


HAML is kind of mini markup language whereas Zen Coding is collection of plugins (not markup language) made for various editors.

You can use either of them. I personally use Zen Coding though.

Quote:

At its core, Haml is a lightweight markup language.

--

Zen Coding is an editor plugin for high-speed HTML, XML, XSL (or any other structured code format) coding and editing. The core of this plugin is a powerful abbreviation engine which allows you to expand expressions—similar to CSS selectors—into HTML code.

like image 36
Sarfraz Avatar answered Jan 12 '23 16:01

Sarfraz