Haml

877 views

Published on

The difference between HAML and HTML.

Published in: Technology, Design
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
877
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Haml

    1. 1. HAMLMike SilvisHungry Academy Class of 2012
    2. 2. HAML Mike Silvis Hungry Academy Class of 2012@MIKESILVIS MIKESILVIS MIKE.SILVIS MIKE-SILVIS MIKE.SILVIS@
    3. 3. VSPENGUINS VS FLYERS PLAYOFF GAME #2TONIGHT @ 7PM
    4. 4. WHAT IS HAML?BESIDES THIS AWESOME DUDE?
    5. 5. CORE PRINCIPLESWHY IT’S AWESOME
    6. 6. MARKUP SHOULD BE BEAUTIFUL (EASY TO READ)CORE PRINCIPLESWHY IT’S AWESOME
    7. 7. MARKUP SHOULD BE BEAUTIFUL (EASY TO READ) MARKUP SHOULD BE DRY (WHY REPEAT OURSELVES)CORE PRINCIPLESWHY IT’S AWESOME
    8. 8. MARKUP SHOULD BE BEAUTIFUL (EASY TO READ) MARKUP SHOULD BE DRY (WHY REPEAT OURSELVES) MARKUP SHOULD WELL-INDENTED (EASILY NEST DIVS)CORE PRINCIPLESWHY IT’S AWESOME
    9. 9. MARKUP SHOULD BE BEAUTIFUL (EASY TO READ) MARKUP SHOULD BE DRY (WHY REPEAT OURSELVES) MARKUP SHOULD WELL-INDENTED (EASILY NEST DIVS) HTML STRUCTURE SHOULD BE CLEAR (RULES!)CORE PRINCIPLESWHY IT’S AWESOME
    10. 10. ERB ~141 CHARACTERS HAML ~71 ~ 30 SECONDS TO TYPE ~ 15 SECONDS TO TYPESAMPLEAND THAT’S A SMALL SAMPLE
    11. 11. REAL EXAMPLE
    12. 12. REAL EXAMPLE
    13. 13. RUBY LINK_TO USER.NAME, USER_PATH(USER), {:CLASS => "USER", :ID => "MEE"} CSS . USER { FLOAT:RIGHT; }HAML .A{:HREF =>”/CART”}= VIEW YOUR CARTERB <A HREF=”CART”> <%= “YOUR CART” %></A>LOOKS MORE LIKE RUBY & CSSEASIEST TO SWITCH BETWEEN VIEW AND PURE RUBY
    14. 14. CONVERTING SNIPPETSHTTP://HTML2HAML.HEROKU.COM/
    15. 15. $ find . -name *erb | xargs ruby -e ARGV.each { |i| puts "html2haml -r #{i} #{i.sub(/erb$/,"haml")}"} | bashHTML2HAML -R ./APP/VIEWS/LAYOUTS/APPLICATION.HTML.ERB ./APP/VIEWS/LAYOUTS/APPLICATION.HTML.HAMLHTML2HAML -R ./APP/VIEWS/USERS/_FORM.HTML.ERB ./APP/VIEWS/USERS/_FORM.HTML.HAMLHTML2HAML -R ./APP/VIEWS/USERS/EDIT.HTML.ERB ./APP/VIEWS/USERS/EDIT.HTML.HAMLHTML2HAML -R ./APP/VIEWS/USERS/INDEX.HTML.ERB ./APP/VIEWS/USERS/INDEX.HTML.HAMLHTML2HAML -R ./APP/VIEWS/USERS/NEW.HTML.ERB ./APP/VIEWS/USERS/NEW.HTML.HAMLHTML2HAML -R ./APP/VIEWS/USERS/SHOW.HTML.ERB ./APP/VIEWS/USERS/SHOW.HTML.HAMLBASH COMMANDTRANSFORM YOUR STORE ENGINE TO USE HAML!

    ×