July
12th,
2014
I really appreciate Slim view templates. What I don’t appreciate is Haml-style shorthand for things like CSS class names.
Haml (and Slim) allow you to code
<span class="foo bar">blah blah</span>
as
span.foo.bar
blah blah
That works just fine, until you have class names (as in Bootstrap or UIKit with dashes (hyphens) in the class names.
If you want to code
<div class="col-md-8">
<!== markup... -->
</div>
the naive Haml-influenced stylist might write
.col-md-8
/ ...
/ ...more markup...
which won’t work. Ruby comes along, interpreting the Haml/Slim DSL, and looks
for variables named col
and md
to build the expression col - md - 8
, and
barfs when it can’t.
The fix is to write the HTML without the angle brackets:
div class="col-md-8"
/ ...
/ ...more markup...
You Have Been Warned.
- tumblr (29) ,
- html (1) ,
- haml (1) ,
- slim (1) ,
- markup (4) ,
- css (2) ,
- styling (1) ,
- pitfalls (1) ,
- errors (1)