SlideShare a Scribd company logo
Why HAML?




Kirill Zonov (graffzon)
From ERB to Haml (Step 1)
<div class="offering">
  <div class="name">
     <%= offering.name %>
  </div>
  <div class="symbol">
     <%= offering.symbol %>
  </div>
  <div class="last_price">
     <%= number_to_currency offering.last_price %>
  </div>
  <div class="last_traded_at">
     <%= last_trade_at.to_formatted_s(:short) %>
  </div>
  <div class="actions">
     <%= link_to "buy", offering_new_bid_path(offering) %>
     <% if offering.owners.find_by_user_id(session[:uid]) %>
       <%= link_to "sell", offering_new_ask_path(offering) %>
     <% end %>
  </div>
</div>
From ERB to Haml (Step 2)

<div class="offering">
  <div class="name">
     <%= offering.name %>
  <div class="symbol">
     <%= offering.symbol %>
  <div class="last_price">
     <%= number_to_currency offering.last_price %>
  <div class="last_traded_at">
     <%= last_trade_at.to_formatted_s(:short) %>
  <div class="actions">
     <%= link_to "buy", offering_new_bid_path(offering) %>
     <% if offering.owners.find_by_user_id(session[:uid]) %>
       <%= link_to "sell", offering_new_ask_path(offering) %>
From ERB to Haml (Step 3)

.offering
   .name
       = offering.name
    .symbol
       = offering.symbol
    .last_price
       = number_to_currency offering.last_price
    .last_traded_at
       = last_trade_at.to_formatted_s(:short)
    .actions
       = link_to "buy", offering_new_bid_path(offering)
       - if offering.owners.find_by_user_id(session[:uid])
          = link_to "sell", offering_new_ask_path(offering)
Main ideas of Haml

               Markup should:



● be beautiful
● be clean
● be sensible
● follow the rules
Rules of indentations

.some_div
  line one
  line two                <div class='some_div'> line one line two </div> <div
                          class='some_div_two'> line one </div>
.some_div_two             line two
  line one
line two



If we try that:
%h1 test
work?
(<h1> test
         work? </h1> )

Immediately we take error:
Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
Size of code (erb)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
   <title>
      <%= configatron.app_name %> - <%= yield(:title) || 'Home' %>
   </title>
   <%= stylesheet_link_tag :flutie, 'application' %>
   <%= javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' %>
   <%= csrf_meta_tag %>
   <%= yield(:head) %>
   <%= yield :javascript %>
 </head>
<body>
   <div class="content">
   <%= render 'layouts/navigation' %>
   <hr />
   <%= render 'layouts/messages' %>
   <% if show_title? %>
      <h1>
         <%= yield(:title) %>
      </h1>
   <% end %>
   <%= yield %>
   </div>
</body>
</html>
Size of code (haml)


!!!
%html
  %head
  %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"}
  %title #{configatron.app_name} - #{yield(:title) || 'Home'}
  = stylesheet_link_tag :flutie, 'application'
  = javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet'
  = csrf_meta_tag
  = yield(:head)
  = yield :javascript
%body .content
  = render 'layouts/navigation'
  %hr = render 'layouts/messages'
  %h1=yield(:title)
  if show_title?
    = yield
No need for words ;)
Any problems with haml?




● Perfomance problems
● Need for retraining
Perfomance

   Haml - 0.00033s
   ERB - 0.000222s
   Slim - 0.000254s
   Код:


Haml                                   ERB                                           Slim
%h1 Haml#index %p Find me in           <h1>Erb#index</h1> <p>Find me in              h1 Haml#index p Find me in
app/views/haml/index.html.erb =@haml   app/views/erb/index.html.erb</p> <%= @erb %   app/views/slim/index.html.erb = @slim
                                       >
Intuitive perception

Html with css:
<div class="highlight">
  this is some stuff
</div>
.highlight {
 border: 1px solid #f00 }

Haml with sass:
.highlight
  this is some stuff

.highlight
 border: 1px solid #f00
Now you can see that Haml is
          REALLY better than erb



You also can take a look for my blog graffzon.com

More Related Content

What's hot

9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
Razvan Raducanu, PhD
 
HTML 5 Basics Part One
HTML 5 Basics Part OneHTML 5 Basics Part One
HTML 5 Basics Part One
M Ashraful Islam Jewel
 
Java script
Java scriptJava script
Java script
Sanjay Gunjal
 
Styling with CSS
Styling with CSSStyling with CSS
Styling with CSS
Mike Crabb
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
Anis Ahmad
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
brynary
 
7. copy2 in Symfony 4
7. copy2 in Symfony 47. copy2 in Symfony 4
7. copy2 in Symfony 4
Razvan Raducanu, PhD
 
JavaScript - Part-1
JavaScript - Part-1JavaScript - Part-1
JavaScript - Part-1
Jainul Musani
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
Yehuda Katz
 
Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and Protocols
David Lucia
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
Thinkful
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routing
jagriti srivastava
 
Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011
rivierarb
 
Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2
DanWooster1
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With Cucumber
Sean Cribbs
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
borkweb
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder PresentationDoug Green
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
Jainul Musani
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5
jakemallory
 

What's hot (19)

9. lower in Symfony 4
9. lower in Symfony 49. lower in Symfony 4
9. lower in Symfony 4
 
HTML 5 Basics Part One
HTML 5 Basics Part OneHTML 5 Basics Part One
HTML 5 Basics Part One
 
Java script
Java scriptJava script
Java script
 
Styling with CSS
Styling with CSSStyling with CSS
Styling with CSS
 
jQuery from the very beginning
jQuery from the very beginningjQuery from the very beginning
jQuery from the very beginning
 
What's new in Rails 2?
What's new in Rails 2?What's new in Rails 2?
What's new in Rails 2?
 
7. copy2 in Symfony 4
7. copy2 in Symfony 47. copy2 in Symfony 4
7. copy2 in Symfony 4
 
JavaScript - Part-1
JavaScript - Part-1JavaScript - Part-1
JavaScript - Part-1
 
Merb jQuery
Merb jQueryMerb jQuery
Merb jQuery
 
Simple Markdown with Ecto and Protocols
Simple Markdown with Ecto and ProtocolsSimple Markdown with Ecto and Protocols
Simple Markdown with Ecto and Protocols
 
Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)Build a game with javascript (may 21 atlanta)
Build a game with javascript (may 21 atlanta)
 
Angular directive filter and routing
Angular directive filter and routingAngular directive filter and routing
Angular directive filter and routing
 
Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011Mechanize at the Ruby Drink-up of Sophia, November 2011
Mechanize at the Ruby Drink-up of Sophia, November 2011
 
Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2Upstate CSCI 450 WebDev Chapter 2
Upstate CSCI 450 WebDev Chapter 2
 
Story Driven Development With Cucumber
Story Driven Development With CucumberStory Driven Development With Cucumber
Story Driven Development With Cucumber
 
JavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM ManipulationJavaScript: Ajax & DOM Manipulation
JavaScript: Ajax & DOM Manipulation
 
Coder Presentation
Coder  PresentationCoder  Presentation
Coder Presentation
 
JavaScript Introduction
JavaScript IntroductionJavaScript Introduction
JavaScript Introduction
 
URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5URUG Ruby on Rails Workshop - Sesssion 5
URUG Ruby on Rails Workshop - Sesssion 5
 

Viewers also liked

Facebook for public health - NPIN
Facebook for public health - NPINFacebook for public health - NPIN
Facebook for public health - NPINGiuseppe Fattori
 
2.tao of topic maps
2.tao of topic maps2.tao of topic maps
2.tao of topic maps
Gabriel Hopmans
 
3.typing and advanced constructs
3.typing and advanced constructs3.typing and advanced constructs
3.typing and advanced constructs
Gabriel Hopmans
 
Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Mightybytes
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluationBillysmedia
 
Saa s案例分析01
Saa s案例分析01Saa s案例分析01
Saa s案例分析01
shaoshao11
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2ian11644
 
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Elías Urrejola
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluationBillysmedia
 
20121204 are your lights on?
20121204 are your lights on?20121204 are your lights on?
20121204 are your lights on?jasonmel
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2ian11644
 
Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Frost & Sullivan
 
Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13
Jeffrey Zinn
 

Viewers also liked (20)

Facebook for public health - NPIN
Facebook for public health - NPINFacebook for public health - NPIN
Facebook for public health - NPIN
 
2.tao of topic maps
2.tao of topic maps2.tao of topic maps
2.tao of topic maps
 
3.typing and advanced constructs
3.typing and advanced constructs3.typing and advanced constructs
3.typing and advanced constructs
 
Eurovegas
EurovegasEurovegas
Eurovegas
 
MAN2012
MAN2012MAN2012
MAN2012
 
Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12Columbia Corporate Strategy Retreat 03.14.12
Columbia Corporate Strategy Retreat 03.14.12
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluation
 
Saa s案例分析01
Saa s案例分析01Saa s案例分析01
Saa s案例分析01
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2
 
Pertemuan 7
Pertemuan 7Pertemuan 7
Pertemuan 7
 
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
Distribution of Silicon iin the Allumiinum Matriix for Rear Passiivated Solla...
 
As media course work- evaluation
As media course work- evaluationAs media course work- evaluation
As media course work- evaluation
 
6. analisis jaringan
6. analisis jaringan6. analisis jaringan
6. analisis jaringan
 
20121204 are your lights on?
20121204 are your lights on?20121204 are your lights on?
20121204 are your lights on?
 
Arthur conan doyle2
Arthur conan doyle2Arthur conan doyle2
Arthur conan doyle2
 
Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01Ec tech heritage buildings 11_mn01
Ec tech heritage buildings 11_mn01
 
Ragged school
Ragged schoolRagged school
Ragged school
 
Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13Backup and Security Lite WCPHX13
Backup and Security Lite WCPHX13
 
Body parts
Body partsBody parts
Body parts
 
Pertemuan 8
Pertemuan 8Pertemuan 8
Pertemuan 8
 

Similar to Haml. New HTML? (RU)

AEM Sightly Template Language
AEM Sightly Template LanguageAEM Sightly Template Language
AEM Sightly Template Language
Gabriel Walt
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
Ted Kulp
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2RORLAB
 
Clean separation
Clean separationClean separation
Clean separation
atorreno
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
LearningTech
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialYi-Ting Cheng
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
Rory Gianni
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the TrenchesXavier Noria
 
SEO for Developers
SEO for DevelopersSEO for Developers
SEO for Developers
Christopher Le
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
Knoldus Inc.
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-public
Chul Ju Hong
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatterns
Chul Ju Hong
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le Wagon
Alex Benoit
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
Kyle Cearley
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
Pedro Cunha
 
Php
PhpPhp
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
Mark
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
Mark
 
Intro to Haml
Intro to HamlIntro to Haml
Intro to Haml
Clifford Heath
 

Similar to Haml. New HTML? (RU) (20)

AEM Sightly Template Language
AEM Sightly Template LanguageAEM Sightly Template Language
AEM Sightly Template Language
 
The Rails Way
The Rails WayThe Rails Way
The Rails Way
 
Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101Geek Moot '09 -- Smarty 101
Geek Moot '09 -- Smarty 101
 
Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2Action View Form Helpers - 1, Season 2
Action View Form Helpers - 1, Season 2
 
Clean separation
Clean separationClean separation
Clean separation
 
Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用Html, CSS, Javascript, Jquery, Meteor應用
Html, CSS, Javascript, Jquery, Meteor應用
 
OSDC 2009 Rails Turtorial
OSDC 2009 Rails TurtorialOSDC 2009 Rails Turtorial
OSDC 2009 Rails Turtorial
 
RoR 101: Session 2
RoR 101: Session 2RoR 101: Session 2
RoR 101: Session 2
 
Documenting from the Trenches
Documenting from the TrenchesDocumenting from the Trenches
Documenting from the Trenches
 
SEO for Developers
SEO for DevelopersSEO for Developers
SEO for Developers
 
Introduction of Html/css/js
Introduction of Html/css/jsIntroduction of Html/css/js
Introduction of Html/css/js
 
Rails antipattern-public
Rails antipattern-publicRails antipattern-public
Rails antipattern-public
 
Rails antipatterns
Rails antipatternsRails antipatterns
Rails antipatterns
 
Rails for Beginners - Le Wagon
Rails for Beginners - Le WagonRails for Beginners - Le Wagon
Rails for Beginners - Le Wagon
 
Building Potent WordPress Websites
Building Potent WordPress WebsitesBuilding Potent WordPress Websites
Building Potent WordPress Websites
 
Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11Ruby on Rails at PROMPT ISEL '11
Ruby on Rails at PROMPT ISEL '11
 
Php
PhpPhp
Php
 
Angular.js Fundamentals
Angular.js FundamentalsAngular.js Fundamentals
Angular.js Fundamentals
 
AngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.jsAngularJS vs. Ember.js vs. Backbone.js
AngularJS vs. Ember.js vs. Backbone.js
 
Intro to Haml
Intro to HamlIntro to Haml
Intro to Haml
 

More from Kirill Zonov

AWS X-Ray introduction and my experience
AWS X-Ray introduction and my experienceAWS X-Ray introduction and my experience
AWS X-Ray introduction and my experience
Kirill Zonov
 
Kubernetes and Helm 101
Kubernetes and Helm 101Kubernetes and Helm 101
Kubernetes and Helm 101
Kirill Zonov
 
IBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interfaceIBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interface
Kirill Zonov
 
DevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshopDevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshop
Kirill Zonov
 
Go for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupGo for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B Meetup
Kirill Zonov
 
Ruby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it againRuby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it again
Kirill Zonov
 
Haskell. Getting started (RU)
Haskell. Getting started (RU)Haskell. Getting started (RU)
Haskell. Getting started (RU)
Kirill Zonov
 

More from Kirill Zonov (7)

AWS X-Ray introduction and my experience
AWS X-Ray introduction and my experienceAWS X-Ray introduction and my experience
AWS X-Ray introduction and my experience
 
Kubernetes and Helm 101
Kubernetes and Helm 101Kubernetes and Helm 101
Kubernetes and Helm 101
 
IBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interfaceIBM Watson as tutor, not a voice interface
IBM Watson as tutor, not a voice interface
 
DevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshopDevOpsDays Berlin 2018 Terraform hands-on workshop
DevOpsDays Berlin 2018 Terraform hands-on workshop
 
Go for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B MeetupGo for Rubyists. August 2018. RUG-B Meetup
Go for Rubyists. August 2018. RUG-B Meetup
 
Ruby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it againRuby on Grapes. Why did we choose Grape and why I would choose it again
Ruby on Grapes. Why did we choose Grape and why I would choose it again
 
Haskell. Getting started (RU)
Haskell. Getting started (RU)Haskell. Getting started (RU)
Haskell. Getting started (RU)
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
UiPathCommunity
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
ViralQR
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
Pierluigi Pugliese
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.Welocme to ViralQR, your best QR code generator.
Welocme to ViralQR, your best QR code generator.
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024By Design, not by Accident - Agile Venture Bolzano 2024
By Design, not by Accident - Agile Venture Bolzano 2024
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 

Haml. New HTML? (RU)

  • 2. From ERB to Haml (Step 1) <div class="offering"> <div class="name"> <%= offering.name %> </div> <div class="symbol"> <%= offering.symbol %> </div> <div class="last_price"> <%= number_to_currency offering.last_price %> </div> <div class="last_traded_at"> <%= last_trade_at.to_formatted_s(:short) %> </div> <div class="actions"> <%= link_to "buy", offering_new_bid_path(offering) %> <% if offering.owners.find_by_user_id(session[:uid]) %> <%= link_to "sell", offering_new_ask_path(offering) %> <% end %> </div> </div>
  • 3. From ERB to Haml (Step 2) <div class="offering"> <div class="name"> <%= offering.name %> <div class="symbol"> <%= offering.symbol %> <div class="last_price"> <%= number_to_currency offering.last_price %> <div class="last_traded_at"> <%= last_trade_at.to_formatted_s(:short) %> <div class="actions"> <%= link_to "buy", offering_new_bid_path(offering) %> <% if offering.owners.find_by_user_id(session[:uid]) %> <%= link_to "sell", offering_new_ask_path(offering) %>
  • 4. From ERB to Haml (Step 3) .offering .name = offering.name .symbol = offering.symbol .last_price = number_to_currency offering.last_price .last_traded_at = last_trade_at.to_formatted_s(:short) .actions = link_to "buy", offering_new_bid_path(offering) - if offering.owners.find_by_user_id(session[:uid]) = link_to "sell", offering_new_ask_path(offering)
  • 5. Main ideas of Haml Markup should: ● be beautiful ● be clean ● be sensible ● follow the rules
  • 6. Rules of indentations .some_div line one line two <div class='some_div'> line one line two </div> <div class='some_div_two'> line one </div> .some_div_two line two line one line two If we try that: %h1 test work? (<h1> test work? </h1> ) Immediately we take error: Illegal nesting: content can't be both given on the same line as %h1 and nested within it.
  • 7. Size of code (erb) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> <%= configatron.app_name %> - <%= yield(:title) || 'Home' %> </title> <%= stylesheet_link_tag :flutie, 'application' %> <%= javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' %> <%= csrf_meta_tag %> <%= yield(:head) %> <%= yield :javascript %> </head> <body> <div class="content"> <%= render 'layouts/navigation' %> <hr /> <%= render 'layouts/messages' %> <% if show_title? %> <h1> <%= yield(:title) %> </h1> <% end %> <%= yield %> </div> </body> </html>
  • 8. Size of code (haml) !!! %html %head %meta{'http-equiv' => "Content-Type", 'content' => "text/html; charset=utf-8"} %title #{configatron.app_name} - #{yield(:title) || 'Home'} = stylesheet_link_tag :flutie, 'application' = javascript_include_tag :defaults, 'rails.validations', 'jquery-snippet' = csrf_meta_tag = yield(:head) = yield :javascript %body .content = render 'layouts/navigation' %hr = render 'layouts/messages' %h1=yield(:title) if show_title? = yield
  • 9. No need for words ;)
  • 10. Any problems with haml? ● Perfomance problems ● Need for retraining
  • 11. Perfomance Haml - 0.00033s ERB - 0.000222s Slim - 0.000254s Код: Haml ERB Slim %h1 Haml#index %p Find me in <h1>Erb#index</h1> <p>Find me in h1 Haml#index p Find me in app/views/haml/index.html.erb =@haml app/views/erb/index.html.erb</p> <%= @erb % app/views/slim/index.html.erb = @slim >
  • 12. Intuitive perception Html with css: <div class="highlight"> this is some stuff </div> .highlight { border: 1px solid #f00 } Haml with sass: .highlight this is some stuff .highlight border: 1px solid #f00
  • 13. Now you can see that Haml is REALLY better than erb You also can take a look for my blog graffzon.com