Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Sassをはじめよう!
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
448jp | OKI Yoshiya
February 17, 2014
Technology
3.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Sassをはじめよう!
DIST.1 「Sass」 発表資料
448jp | OKI Yoshiya
February 17, 2014
Transcript
39 slides
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
More Decks by 448jp | OKI Yoshiya
See All by 448jp | OKI Yoshiya
Vue Fes Japan 2026 タイムテーブル徹底解説
448jp
1
1k
今から始めるClaude Code超入門
448jp
8
11k
人はなぜコミュニティとつながると幸せを感じるのか
448jp
3
550
Webデザイナーが押さえておきたいエンジニアとの連携ポイント
448jp
0
4.4k
合意形成のためのFigma活用術
448jp
1
290
書く・即・DONEな仕組みをNuxtで作る
448jp
0
500
神速でワイヤーフレームを作るためのライブラリ
448jp
1
980
Figmaで神速ドキュメント作成術
448jp
3
2.9k
今から始めるFigma超入門
448jp
0
1.8k
Other Decks in Technology
See All in Technology
bpf_arenaとstruct_opsを使うのが難しかった話
masu_mi
0
230
Bots in Kiro Crew (One point of contact for ongoing work) | Kiro: Zero to Hero 12
inariku
PRO
1
130
Claude Securityを使ってみた / claude-security-claude-code-meetup-nagoya
tnir
0
110
evcc & Home Assistant
naltatis
0
700
Where Should Platform Complexity Live? Lessons from a Cross-Team PR Preview Platform
taiki45
0
110
Ebitengine製iOSアプリ公開ボタンを押す会
eiei114
0
120
AWS Emulator を評価する: 手元で動く AWS の API の仕組み、始め方、確かめ方
inariku
PRO
1
260
異夢同船〜異なる夢でも同じ船でなんとかする〜
fortegp05
0
190
小さなエージェントから始めてみよう!実践コンテキストエンジニアリング
iwamot
PRO
0
120
会社説明資料_最新版
demaecan
0
32k
Linuxネットワークスタック進化の軌跡: 過去10年の歩みと最新トレンド
orimanabu
3
600
AIが会計業務の伴走者に。 マネーフォワード クラウド会計MCPサーバーで実現するAI前提の新しい業務プロセス
nobitabashi
0
120
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.6k
Docker and Python
trallard
47
4.3k
Utilizing Notion as your number one productivity tool
mfonobong
4
640
Typedesign – Prime Four
hannesfritz
42
3.2k
The SEO identity crisis: Don't let AI make you average
varn
0
630
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
920
Raft: Consensus for Rubyists
vanstee
143
7.9k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
470
The Art of Programming - Codeland 2020
erikaheidi
57
14k
We Are The Robots
honzajavorek
0
440
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k