Haml to Html Converter (sans Rails Project)

The simple fact is…

!!! 5
%html
  %head
    %title Awesome Sauce Website
  %body
    %h1 Do you like sauce?
    -# let me answer the question
    .answer  Red or white?

is better than…


<!DOCTYPE html>
<html>
  <head>
    <title>Awesome Sauce Website</title>
  </head>
  <body>
    <h1>Do you like sauce?</h1>
    <div class=‘answer’>Red or white?</div>
  </body>
</html>



The above is Haml followed by HTML. While it’s true that most decent IDEs and Text Editors will support code completion of the tags, xml is verbose and sloppy by today’s standards. And the above is simplistic, but Haml quickly shows its strength on more complicated tag nests.

Unfortunately, there is no native plugin support for any of the IDEs I use (… eclipse… I know…), but you can run a simple command line to convert Haml to Html. After, of course, installing Ruby and the haml gem. (Instructions in the reference below)

> haml somepage.haml somepage.html

And that takes your haml and spits it to an html page. This is obviously not an ideal workflow, so the search continues…

I don’t particularly like that haml is somewhat attached to Ruby. That is, Haml was born via Ruby, but it in of itself is just a language and converter. More interesting is a javascript based approach to enabling haml like syntax to html.

Which is where Jade comes in… http://jade-lang.com/

On the CSS side of things we also have Less… http://lesscss.org/

And if we add in some Coffeescript… http://jashkenas.github.com/coffee-script/

We end up having a pretty nice stack going. New get-to-the-point languages for all of our web work. And on the backend we can stick to Groovy / Grails and continue to slim down that mess.

All of this is great until google release their Dart / Dash or whatever… We’ll see if we again have to rethink everything we know about web dev… Which, I guess just keeps us all employed and working faster to replace everything.

References:

http://haml-lang.com/

http://stackoverflow.com/questions/2278233/standalone-app-or-text-editor-plugin-to-convert-haml-to-html

http://jade-lang.com/


Published by and tagged Code using 322 words.