際際滷

際際滷Share a Scribd company logo
CSS Nite LP, Disk 32: Sass
Why Sass?
Hiroki Tani
Front-end Engineer
CyberAgent, Inc
inkdesign.jp
Sass & Compass莿徃謇T?
CSS のベストプラクティスを紳覆茲gFするために
O俐妻云高望幄塀氏芙サイバ`エ`ジェント
OU?鍬U坤肇奪廛好織献
圻Sass and Compass in ActionManning
圻广宀Wynn Netherland/Nathan Weizenbaum/
Chris Eppstein/Brandon Mathis
鯉嚠協2,800劭飽
碧嚠協264ペ`ジ
k佩栽葭症
2014/3/17
k嗷莇
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why need
?
Sassが駅勣なのかなぜ、
Designer
Programmer
Why Sass?
或珂赫´
或珂赫´
What does
Sassは採をしてくれるのか
do?
Why Sass?
CSSにプログラムの來|を嚥える
CSSメタ冱Z
CSSに篳やv方、處麻や訳周塀など
プログラムのC嬬をもたらす、
CSSをより薦にするための冱Z
CSSに篳やv方、處麻や訳周塀など
プログラムのC嬬をもたらす、
CSSをより薦にするための冱Z
Why Sass?
ul {	
	 margin: 0;	
	 padding: 0;	
	 list-style: none;		
}	
!
li {	
	 display: inline-block;	
}	
!
a {	
	 display: block;	
	 padding: 6px 12px;	
	 text-decoration: none;	
}
Nathan Weizenbaum
@nex3
Hampton Catlin
@hcatlin
ul	
	 margin: 0	
	 padding: 0	
	 list-style: none	
!
li	
	 display: inline-block	
!
a	
	 display: block	
	 padding: 6px 12px	
	 text-decoration: none	
.sass
ul	
	 margin: 0	
	 padding: 0	
	 list-style: none	
!
li	
	 display: inline-block	
!
a	
	 display: block	
	 padding: 6px 12px	
	 text-decoration: none	
.sass
ul {	
	 margin: 0;	
	 padding: 0;	
	 list-style: none;		
}	
!
li {	
	 display: inline-block;	
}	
!
a {	
	 display: block;	
	 padding: 6px 12px;	
	 text-decoration: none;	
}	
.scss
CSSに篳やv方、處麻や訳周塀など
プログラムのC嬬をもたらす、
CSSをより薦にするための冱Z
.scss
$font-stack: Helvetica, sans-serif;	
$primary-color: #333;	
!
body {	
font: 100% $font-stack;	
color: $primary-color;	
}
.scss
.container { width: 100%; }	
!
article[role="main"] {	
float: left;	
width: 600px / 960px * 100%;	
}	
!
aside[role="complimentary"] {	
float: right;	
width: 300px / 960px * 100%;	
}
.scss
$type: monster;	
!
p {	
@if $type == ocean {	
color: blue;	
} @else if $type == matador {	
color: red;	
} @else if $type == monster {	
color: green;	
} @else {	
color: black;	
}	
}
How to use
どうやって聞うのか
?
Sassは、
.sass
.scss
or
.sass
.scss
or
?
.sass
.scss
or
.sass
.scss
or
Compile!
.css
.css
!
.css
Why Sass?
Why Sass?
Why Choose
Sassをxぶのか
?
なぜ、
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Why Sass?
Don't rely too much on
ただのツ`ルSassは、
^If you write poor CSS,
a pre-processor won't make it suck less. ̄
- Bermon Painter
Why Sass?
.mod_listType1 {	
	 section {	
	 	 margin-bottom:1em;	
	 }	
	 h1 {	
	 	 margin:0 0 .5em .5em;	
	 	 font-size:fz(15);	
	 	 -webkit-text-shadow:0px 1px 0px rgba(255,255,255,0.75);	
	 	 text-shadow:0px 1px 0px rgba(255,255,255,0.75);	
	 }	
	 ul {	
	 	 background-color:#ffffff;	
	 	 border:#c3c3c3 1px solid;	
	 	 overflow:hidden;	
	 	 @include radius(12px);	
	 	 li {	
	 	 	 border-top:#C3C3C2 1px solid;	
	 	 	 margin-top:-1px;	
	 	 	 margin-bottom:1px;	
	 	 	 font-size:fz(16);	
	 	 	 &:first-child {	
	 	 	 	 a.disable {	
	 	 	 	 	 @include radius-tr(12px);	
	 	 	 	 	 @include radius-tl(12px);	
	 	 	 	 }	
	 	 	 }	
	 	 	 &:last-child {	
	 	 	 	 a.disable {	
	 	 	 	 	 @include radius-br(12px);	
.scss
-webkit-border-radius:42%/50%;	
	 	 	 	 	 border-radius:42%/50%;	
	 	 	 	 	 -webkit-text-shadow:none;	
	 	 	 	 	 text-shadow:none;	
	 	 	 	 	 font-size:fz(10);	
	 	 	 	 	 color:#ffffff;	
	 	 	 	 	 line-height:1;	
	 	 	 	 }	
	 	 	 }	
	 	 }	
	 }	
}	
/* mod_listType3 */	
.mod_listType3 {	
	 @extend .mod_listType1;	
	 ul {	
	 	 @include radius(0px);	
	 	 -webkit-box-shadow:none;	
	 	 box-shadow:none;	
	 	 li {	
	 	 	 a {	
	 	 	 	 &::after {	
	 	 	 	 	 display:none;	
	 	 	 	 }	
	 	 	 }	
	 	 }	
	 }	
}	
.scss
.scss/* listType */	
.mod_listType1 section, .mod_listType3 section, .mod_listType4 section, .mod_listType5
section, .mod_listType8 section, .mod_listType7 section {	
margin-bottom: 1em;	
}	
.mod_listType1 h1, .mod_listType3 h1, .mod_listType4 h1, .mod_listType5 h1, .mod_listType8
h1, .mod_listType7 h1 {	
margin: 0 0 .5em .5em;	
font-size: 15px;	
-webkit-text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.75);	
text-shadow: 0px 1px 0px rgba(255, 255, 255, 0.75);	
}	
.mod_listType1 ul, .mod_listType3 ul, .mod_listType4 ul, .mod_listType5 ul, .mod_listType8
ul, .mod_listType7 ul {	
background-color: #ffffff;	
border: #c3c3c3 1px solid;	
overflow: hidden;	
border-radius: 12px;	
}	
.mod_listType1 ul li, .mod_listType3 ul li, .mod_listType4 ul li, .mod_listType5 ul li, .mod_listType8 ul
li, .mod_listType7 ul li {	
border-top: #C3C3C2 1px solid;	
margin-top: -1px;	
margin-bottom: 1px;	
font-size: 16px;	
}	
.mod_listType1 ul li:first-child a.disable, .mod_listType3 ul li:first-child a.disable, .mod_listType4 ul
li:first-child a.disable, .mod_listType5 ul li:first-child a.disable, .mod_listType8 ul li:first-child
a.disable, .mod_listType7 ul li:first-child a.disable {	
border-radius: 12px;	
border-radius: 12px;	
}	
.mod_listType1 ul li:last-child a.disable, .mod_listType3 ul li:last-child a.disable, .mod_listType4 ul
li:last-child a.disable, .mod_listType5 ul li:last-child a.disable, .mod_listType8 ul li:last-child
a.disable, .mod_listType7 ul li:last-child a.disable {	
border-radius: 12px;
.scss
border-radius: 12px;	
border-radius: 12px;	
}	
.mod_listType1 ul li:last-child a.disable, .mod_listType3 ul li:last-child a.disable, .mod_listType4 ul
li:last-child a.disable, .mod_listType5 ul li:last-child a.disable, .mod_listType8 ul li:last-child
a.disable, .mod_listType7 ul li:last-child a.disable {	
border-radius: 12px;	
border-radius: 12px;	
}	
.mod_listType1 ul li a, .mod_listType3 ul li a, .mod_listType4 ul li a, .mod_listType5 ul li
a, .mod_listType8 ul li a, .mod_listType7 ul li a {	
display: block;	
width: 100%;	
padding: .75em .7em;	
box-sizing: border-box;	
-webkit-text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);	
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);	
position: relative;	
}	
!
.mod_listType1 ul li a::after, .mod_listType3 ul li a::after, .mod_listType4 ul li
a::after, .mod_listType5 ul li a::after, .mod_listType8 ul li a::after, .mod_listType7 ul li
a::after, .mod_listType8 ul li a::after, .mod_listType9 ul li a::after, .mod_listType11 ul li
a::after, .mod_listType12 ul li a::after, .mod_listType13 ul li a::after, .mod_listType14 ul li a::after {	
display: block;	
width: 9px;	
height: 14px;	
position: absolute;	
top: 50%;	
right: 1em;	
margin-top: -10px;	
content: "]";	
font-size: 12px;	
color: brown;	
-webkit-text-shadow: none;	
text-shadow: none;	
}
Why Sass?
margin-bottom: 1em;	
}	
.mod_list__item {	
display: list-item;	
padding: 0 1em;	
line-height: 44px;
Why Sass?
makes CSS fun again.
CSS Nite LP, Disk 32: Sass
Thanks!
hiloki
inkdesign.jp

More Related Content

Why Sass?