Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Sassをはじめよう!
Search
448jp | OKI Yoshiya
February 17, 2014
Technology
0
3k
Sassをはじめよう!
DIST.1 「Sass」 発表資料
448jp | OKI Yoshiya
February 17, 2014
Tweet
Share
More Decks by 448jp | OKI Yoshiya
See All by 448jp | OKI Yoshiya
人はなぜコミュニティとつながると幸せを感じるのか
448jp
3
320
Webデザイナーが押さえておきたいエンジニアとの連携ポイント
448jp
0
4k
合意形成のためのFigma活用術
448jp
0
150
書く・即・DONEな仕組みをNuxtで作る
448jp
0
400
神速でワイヤーフレームを作るためのライブラリ
448jp
1
880
Figmaで神速ドキュメント作成術
448jp
3
2.6k
今から始めるFigma超入門
448jp
0
1.7k
零細Web制作会社のリモートワーク事情
448jp
0
440
エンジニアに120%意図を伝えるためのAdobe XDデザインテクニック
448jp
2
770
Other Decks in Technology
See All in Technology
激動の時代を爆速リチーミングで乗り越えろ
sansantech
PRO
1
190
AIでデータ活用を加速させる取り組み / Leveraging AI to accelerate data utilization
okiyuki99
6
1.5k
IBC 2025 動画技術関連レポート / IBC 2025 Report
cyberagentdevelopers
PRO
2
220
ラスベガスの歩き方 2025年版(re:Invent 事前勉強会)
junjikoide
0
630
データとAIで明らかになる、私たちの課題 ~Snowflake MCP,Salesforce MCPに触れて~ / Data and AI Insights
kaonavi
0
180
Observability — Extending Into Incident Response
nari_ex
1
600
今から間に合う re:Invent 準備グッズと現地の地図、その他ラスベガスを周る際の Tips/reinvent-preparation-guide
emiki
0
110
プロファイルとAIエージェントによる効率的なデバッグ / Effective debugging with profiler and AI assistant
ymotongpoo
1
590
仕様駆動開発を実現する上流工程におけるAIエージェント活用
sergicalsix
9
4.7k
様々なファイルシステム
sat
PRO
0
270
新米エンジニアをTech Leadに任命する ー 成長を支える挑戦的な人と組織のマネジメント
naopr
1
290
OTEPsで知るOpenTelemetryの未来 / Observability Conference Tokyo 2025
arthur1
0
340
Featured
See All Featured
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
A designer walks into a library…
pauljervisheath
209
24k
Visualization
eitanlees
150
16k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4k
The Language of Interfaces
destraynor
162
25k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.2k
YesSQL, Process and Tooling at Scale
rocio
173
15k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.7k
BBQ
matthewcrist
89
9.9k
Automating Front-end Workflow
addyosmani
1371
200k
Transcript
Sassをはじめよう! 沖 良矢(世路庵) 2014.2.14 (Fri) DIST.1 「Sass」
自己紹介 沖 良矢 / OKI Yoshiya @448jp インタラクションデザイナー UNIQLO HAPPY
GIFT (2013) Web Designing (2009~) McCANN WG JAPAN (2012)
お品書き Sassとは何か 制作環境のセットアップ 実用テクニック
Sassについて、 一番知りたいことって なんですか? What do you want to know most
about Sass?
Sassとは何か Chapter.1 | What’s Sass ?
Sass is the most mature, stable, and powerful professional grade
CSS extension language in the world. http://sass-lang.com/
Sassは、世界で最も成熟し安定 した、かつパワフルなプロ級の CSSの拡張言語である。 http://sass-lang.com/
とりあえずどんなもんか #content { background-color: #ff0000; } #content h1 { margin-bottom:
1em; } #content p { line-height: 2em; }
とりあえずどんなもんか #content { background-color: #ff0000; } #content h1 { margin-bottom:
1em; } #content p { line-height: 2em; } #content { background-color: #ff0000; h1 { margin-bottom: 1em; } p { line-height: 2em; } }
サス【Sass】 ≪Syntactically Awesome Style Sheets≫ 構文的に イケてる スタイルシート CSSを効率よく記述するための拡張言語 CSSプリプロセッサ、CSSメタ言語とも
他のCSSプリプロセッサ LESS Bootstrapで採用 機能はSassより少ない クライアントサイドで動的 にCSSを生成 Stylus Node.jsのモジュールとし て誕生 簡素化した記述
Sassの ここがイイ! すべてのバージョンのCSSとの互換性 機能が豊富 7年以上に渡る開発、サポート 採用企業が多い
(LINE, COOKPAD, CyberAgent, NHN Japan…) ユーザー数が多い フレームワークの充実
SASS記法とSCSS記法 #content background-color: #ff0000 h1 margin-bottom: 1em p line-height: 2em
#content { background-color: #ff0000; h1 { margin-bottom: 1em; } p { line-height: 2em; } } SASS記法 SCSS記法
Sassの利用手順 1. Sassファイルを記述する なお、拡張子は「.scss」(SASS記法では「.sass」) 2. 直接Webブラウザに読み込めないので、コンパイルし てCSSに変換 3. CSSとしてWebブラウザに読み込む
ルールのネスト #content { background-color: #ff0000; h1 { margin-bottom: 1em; }
p { line-height: 2em; } } #content { background-color: red; } #content h1 { margin-bottom: 1em; } #content p { line-height: 2em; } Sass CSS
親セレクタの参照 #content a { background-color: #ff0000; &:hover { background-color: #ffff00;
} } #content a { background-color: #ff0000; } #content a:hover { background-color: #ffff00; } Sass CSS
プロパティのネスト #content .book { border: { left: 5px solid #ff0000;
bottom: { width: 5px; style: solid; color: #ff0000; } } } #content .book { border-left: 5px solid #FF0000; border-bottom-width: 5px; border-bottom-style: solid; border-bottom-color: #FF0000; } Sass CSS
1行コメント // イケてるスタイル #content { background-color: #ff0000; } #content {
background-color: #ff0000; } Sass CSS
通常のコメント /* イケてるスタイル */ #content { background-color: #ff0000; } /*
イケてるスタイル */ #content { background-color: #ff0000; } Sass CSS
通常のコメント(compressedフォーマットの場合) /* イケてるスタイル */ #content { background-color: #ff0000; } #content{background-color:#ff0000;}
Sass CSS
絶対に残るコメント(compressedフォーマットの場合も) /*! 絶対にイケてるスタイル */ #content { background-color: #ff0000; } /*!
絶対にイケてるスタイル */#content{background-color:#ff0000;} Sass CSS
変数 $niceColor: #ff0000; #content { background-color: $niceColor; h1 { border-bottom:
1px solid $niceColor; } } #content { background-color: red; } #content h1 { border-bottom: 1px solid red; } Sass CSS
変数のスコープ #content { $niceColor: #ff0000; background-color: $niceColor; } h1 {
border-bottom: 1px solid $niceColor; } error screen.scss (Line 6: Undefined variable: "$niceColor".) Sass CSS
四則演算 #content { background-color: #ff0000; width: 980px – 40px; }
#content { background-color: #ff0000; width: 940px; } Sass CSS
関数 #content { background-color: lighten(#ff0000, 20%); } #content { background-color:
#ff6666; } Sass CSS
独自の関数 @function getDouble($value) { @return $value * 2; } #content
{ background-color: #ff0000; width: getDouble(200px); } #content { background-color: #ff0000; width: 400px; } Sass CSS
インターポレーション(補間) $imageBasePath: "images/"; #content { background-image: url(#{$imageBasePath}hoge.png); } #content {
background-image: url(images/hoge.png); } Sass CSS
スタイルの継承 .content { background-color: #ff0000; border: 1px solid #000000; }
.sub { @extend .content; } .content, .sub { background-color: #ff0000; border: 1px solid #000000; } Sass CSS
ミックスイン @mixin clearfix { &:after { content: ""; clear: both;
display: block; } } .content { @include clearfix; background-color: #ff0000; } .content { background-color: #ff0000; } .content:after { content: ""; clear: both; display: block; } Sass CSS
ミックスイン(引数) @mixin myBorder($width) { border: $width solid #00ff00; } .content
{ @include myBorder(5px); background-color: #ff0000; } .content { border: 5px solid lime; background-color: #ff0000; } Sass CSS
その他の機能 @import パーシャル プレースホルダーセレクタ 変数のデフォルト値 可変長引数 コンテンツブロック コントロールディレクティブ コマンドオプション 他、多数
制作環境のセットアップ Chapter.2 | Setup the production environment
Sassの利用環境 Webサービス GUI CUI IDE
デモ
実用テクニック Chapter.3 | Practical technique
時間の都合で省略… 別の機会で。
まとめ At the end
まとめ Sassは、CSSを効率的に書くための拡張言語 制作環境は自分にあったものを
Thank you ! Photo Credit: mak1e Nathan O'Nions
*christopher* Brett Jordan