Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 14th, 2008, 6:49 AM   #1
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 93
Rep Power: 2 MiKuS is on a distinguished road
HAML - Markup Haiku

While lurking around the bakery i stumbled across a pretty neat html templating language, HAML.

What exactly is HAML?
taken straight from the front page of the haml website
Quote:
Haml takes your gross, ugly templates and replaces them with veritable Haiku.
basicly, it's a shorthand way of writing html, less code (lots less) to look at when developing your pages. Pretty cool.

haml also has a css counterpart called sass, which is what i'm really here to talk about. Sass looks like css, for the most part but adds LOTS of new functionality. Ever wish you could declare a constant in css? you can with sass. Sass is incredible, i wish real css worked like sass.

there is a haml implementation for php but no sass.

I don't plan on using haml in any of my projects because it seems cumbersome, why develop a page in haml when xhtml is second nature.. The only use i have for haml is being able to fit more code on a hand written page, i have a small legend that i can refer to when parsing haml into xhtml.

Anyway check out the site it's a pretty neat project. I'm considering of porting sass to python so i can just batch render a bunch of sass files to css

Last edited by MiKuS; May 14th, 2008 at 6:49 AM. Reason: added baker link
MiKuS is offline   Reply With Quote
Old May 16th, 2008, 4:17 PM   #2
Mocker
Hobbyist Programmer
 
Mocker's Avatar
 
Join Date: Oct 2005
Location: Indiana
Posts: 202
Rep Power: 0 Mocker is an unknown quantity at this point
Send a message via AIM to Mocker
Re: HAML - Markup Haiku

And why, exactly, would you want to declare constants in your style sheet? To save a little bit on copy and pasting? I sure hope it isn't trying to mix logic with the style sheet
__________________
#programmingforums relay - http://thegupstudio.com/cgi-bin/pforelay.cgi
freelance scripts - http://ryanguthrie.com/index.html
Mocker is offline   Reply With Quote
Old May 16th, 2008, 9:06 PM   #3
MiKuS
Programmer
 
Join Date: Jun 2007
Posts: 93
Rep Power: 2 MiKuS is on a distinguished road
Re: HAML - Markup Haiku

to an extent, it would be nice to mix logic into my stylesheet albeit not a lot.

  !main_color = #00ff00

  #main
    :color = !main_color
    :p
      :background-color = !main_color
      :color #000000

is compiled to

 
#main {
    color: #00ff00; }
    #main p {
      background-color: #00ff00;
      color: #000000; }

with sass it is also possible to do basic arithmatic:

  !main_width = 10
  !unit1 = em
  !unit2 = px
  !bg_color = #a5f39e

  #main
    :background-color = !bg_color
    p
      :background-color = !bg_color + #202020
      :width = !main_width + !unit1
    img.thumb
      :width = (!main_width + 15) + !unit2
is compiled to
  #main {
    background-color: #a5f39e; }
    #main p {
      background-color: #c5ffbe;
      width: 10em; }
    #main img.thumb {
      width: 25em; }

as far as logic goes the above is about as complex as you can go, you can perform arithmetic on colours but thats about it. Yes i don't like copy and pasting the same thing over and over again (DRY), I tend to use only a handful of colours and I would rather be able to say !highlight for a highlight or !base for my base colour, opposed to looking through my notes for the colour, copying it, flicking back to my editor, and pasting it. even scrolling to the last occurrence of the colour i want can be a hassle.. why not avoid it?
MiKuS is offline   Reply With Quote
Old May 16th, 2008, 9:36 PM   #4
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Posts: 1,799
Rep Power: 5 Sane will become famous soon enough
Re: HAML - Markup Haiku

I've actually wanted to use math in my CSS many times, to make things like width adjustments proportional. That's neat. Thanks.
Sane is online now   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
help out beginner with some errors (solved) monka Java 8 Mar 3rd, 2005 8:50 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:53 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC