What's New in Haml/Sass 3

25
株式会社永和システムマネジメント / 日本Hamlの会 浦嶌 啓太 What's New in Haml/Sass 3

Transcript of What's New in Haml/Sass 3

Page 1: What's New in Haml/Sass 3

株式会社永和システムマネジメント / 日本Hamlの会

浦嶌 啓太

What's New inHaml/Sass 3

Page 2: What's New in Haml/Sass 3

ursm

http://twitter.com/ursmhttp://d.hatena.ne.jp/ursm/http://github.com/ursm

Copyright © FJORD, LLC

Asakusa.rb

Page 3: What's New in Haml/Sass 3
Page 4: What's New in Haml/Sass 3
Page 5: What's New in Haml/Sass 3
Page 6: What's New in Haml/Sass 3

Haml/Sassの歴史

Page 7: What's New in Haml/Sass 3
Page 8: What's New in Haml/Sass 3

•1 file, 2 classes•HAML::TemplateEngine•HAML::HappyMagicPonyLand•5 special characters# . < / =•no Sass

Page 9: What's New in Haml/Sass 3

#container .section = 'hoge' <p.foo=fuga

Page 10: What's New in Haml/Sass 3

0.1.0 (2006-10-06)

!!!%html %head %title Hello %meta{:content => 'something'} %body ...

Page 11: What's New in Haml/Sass 3

1.0.0 (2006-12-15)•はじめてGemが提供されたリリース•no Sass

Page 12: What's New in Haml/Sass 3

1.5.0 (2007-03-17)•Filterplain, ruby, preserve, erb, …

•Sass is coming!note_bg = #55aaff

#main :width 70% .note :background-color= !note_bg

Page 13: What's New in Haml/Sass 3

2.0.0 (2008-05-24)•HTML escaping&= !=•Sass mixins

=border-radius :-moz-border-radius 8px :-webkit-border-radius 8px

.sidebar +border-radius

Page 14: What's New in Haml/Sass 3

2.2.0 (2009-07-06)•flexible indentation•new attribute syntaxa(href='...')•Mixin arguments+border-radius(8px)•Sass Script and Functions@if, @for, hsl(), round()•Ruby 1.9 support

Page 15: What's New in Haml/Sass 3
Page 16: What's New in Haml/Sass 3

3.0.0 (2010-05-10)•Haml•custom data attributes•Sass•SCSS•some syntax changes•selector inheritance•color functions•haml-spec Integration

Page 17: What's New in Haml/Sass 3

Custom Data Attributes•HTML5 Draft Standard 3.2.3.8Embedding custom non-visible data

<ol> <li data-length="2m11s">Beyond The Sea</li> ...</ol>

%ol %li{:data => {:length => "2m11s"}} Beyond The Sea</li> ...

Page 18: What's New in Haml/Sass 3

SCSS (Sassy CSS)$blue: #3bbfce;$margin: 16px;

.content_navigation { color: $blue;}

.border { padding: $margin / 2; margin: $margin / 2; border: 2px $blue solid;}

Page 19: What's New in Haml/Sass 3
Page 20: What's New in Haml/Sass 3

Syntax Changes

!size = "10px"!color ||= "red"

%p font: size = !size color = !color

$size: "10px"$color: "red" default!

%p font: size: $size color: $color

$ sass-convert --in-place style.sass

Page 21: What's New in Haml/Sass 3

Selector Inheritance

=error border: 1px #f00 color: #fdd

.error +error

.seriousError +error border-width: 3px

.error border: 1px #f00 color: #fdd

.seriousError @extend .error border-width: 3px

Page 22: What's New in Haml/Sass 3

Color Functions•lighten(red, 20%)•darken(blue, 30%)•saturate(#855, 20%)•desaturate(#855, 20%)•adjust-hue(#811, 45deg)•grayscale(hsl(120, 30%, 90%))•complement(hsl(120, 30%, 90%))•a lot more...

Page 23: What's New in Haml/Sass 3

haml-spec Integration

Page 24: What's New in Haml/Sass 3

haml-lang.com sass-lang.com

Page 25: What's New in Haml/Sass 3

Thank you!