`




Concise Layout and Style
HAML & SASS
<div class=”special”>
<p>                                  .special
A <strong>trivial</strong> example     %p
                                        A
case.                                   %strong trivial
</p>                                    example case.
</div>




Simon de Boer – President
simon@ingamer.com
HTML / Template Languages
Lots of textual repetition,    <p>Block #1</p>
opening + closing              <table>
                                <tr>
Browsers give “random”
                                 <td>Block #2</td>
                                </tr>
behaviour with incorrect       <p>Block #3</p>

markup
Strings need proper and       Block #1

context aware escaping        Block #3


Has no opinion on source
                              Block #2


layout
CSS
Extremely repetitious
Lacks
  Inclusions
  Methods
  Variables
Has no opinion on source code layout
Its Great
For projects with at least 2 of:
Lots of custom views
A build process
View caching in production
Assets served from a CDN
Complex page structures
Not Good
Projects where:
You can't check some of the previous
boxes
Production staf are learning HTML/CSS
Its a one-of

Unless – its just your default (like rails)
Implementations
Dynamic Engines   Processors
Rails (haml)      HAML
PHP               Python
Java              Lua
                  Javascript (*)
SASS
 Will watch for
 changes
Source Code Layout Opinion
White space matters
 2 space tabs
 Tab nesting is node/class nesting
Position matters
High powered characters
 %, =, ., {}, (), @, ...
Real Example
Trivial Example
Non-Trivial Example
Real World Example
Links
http://haml-lang.com/
http://sass-lang.com/
http://en.wikipedia.org/wiki/Haml

Haml