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
『保守性の高いcssを書く』という不可能に立ち向かう
Search
やし
June 18, 2019
Programming
850
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
『保守性の高いcssを書く』という不可能に立ち向かう
2019/06/18
giftee tech bash #1
で発表した資料です。
やし
June 18, 2019
More Decks by やし
See All by やし
色について / a-little-bit-about-color
yashi8484
0
34
プログラミング言語学習のススメ / why-do-i-learn-programming-language
yashi8484
0
490
Rust 探訪 / rust-chotto-wakaru
yashi8484
0
95
Web Frontend ビルドツールの過去と現在と未来 / The Past, Present, and Future of Web Frontend Build Tools
yashi8484
0
810
ブラウザの仕組みを完全に理解する / Fully understand how browsers work
yashi8484
0
150
Svelteで作るWebComponents / svelte-web-components
yashi8484
2
2.4k
Other Decks in Programming
See All in Programming
iOSDC2026登壇資料.pdf
riofujimon
0
190
20260914 AIエージェント時代のPlatform Engineering LLM基盤とプロダクトの責務境界線
kanfab1
7
2.2k
AI活用は、個人から組織へ|マルチプレイヤーエージェントハーネス「QM」の社内活用事例 / AI use is moving from individuals to orgs
rkaga
1
280
iOS 27でニュースアプリはどう変わる!? 〜日経電子版の新機能対応と、開発事例から〜
lynnswap
7
13k
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
410
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
440
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
350
MCP Appsでつくるチャット駆動な地図アプリ
nakamori1024
0
110
wkhtmltopdfの次どうするか問題2026
willnet
2
1.8k
巨大モノリシックアプリ モダン化大作戦
ktcryomm
1
1.1k
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
110
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
310
Featured
See All Featured
How to audit for AI Accessibility on your Front & Back End
davetheseo
0
550
Docker and Python
trallard
47
4.2k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
Marketing to machines
jonoalderson
1
5.8k
We Are The Robots
honzajavorek
0
380
Building the Perfect Custom Keyboard
takai
2
890
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
33
5k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
480
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
290
Ethics towards AI in product and experience design
skipperchong
2
390
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
270
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
740
Transcript
『保守性の⾼いcssを書く』という 不可能に⽴ち向かう גࣜձࣾΪϑςΟ 4BB4%JW !ZBTIJ
©2019 giftee Inc. all rights reserved 2 σβΠϯϦχϡʔΞϧ TQ
©2019 giftee Inc. all rights reserved 3 σβΠϯϦχϡʔΞϧ QD
©2019 giftee Inc. all rights reserved 4 σβΠϯϦχϡʔΞϧ QD
©2019 giftee Inc. all rights reserved ࠓ͢͜ͱ 5 • なぜ保守性の⾼いcssを書くのは難しい(不可能︖)
なのか • ⽴ち向かうアプローチ • 保守性の⾼いcssを書けるかもしれない⽅法
©2019 giftee Inc. all rights reserved ࠓ͞ͳ͍͜ͱ 6 • ナウなヤングにバカウケのcssプロパティ
– ex. flexbox, CSS Grid, ...etc • cssの実装⽅針(書き⽅) • 保守性の⾼いcssを書く⽅法
࣭ʂ ©2019 giftee Inc. all rights reserved 7
DTTΛॻ͘ͷ͕ಘҙͳਓʂ ©2019 giftee Inc. all rights reserved 8
͜͜Ͱख͕ڍ͕Βͳ͍༧ఆ ©2019 giftee Inc. all rights reserved 9
DTTΛॻ͘ͷ͕͖ͳਓʂ ©2019 giftee Inc. all rights reserved 10
͔ͨ͠͠Βएׯख͕ڍ͕Δ͔ ©2019 giftee Inc. all rights reserved 11
©2019 giftee Inc. all rights reserved 12 ͳͥಘҙͳਓډͳ͍ͷ͔ • (jsなどの)プログラミングと違う・・・︖
• 求められたページの⾒た⽬を作るだけならできる、けど・・・。
อकੑߴ͘ ߏԽͯ͠ DTTΛॻ͘ ˠ͍͠ ©2019 giftee Inc. all rights reserved
13
ͳ͍ͥ͠ͷ͔ ˠDTT͕$BTDBEJOH4UZMF 4IFFU͔ͩΒ ©2019 giftee Inc. all rights reserved 14
©2019 giftee Inc. all rights reserved 15 カスケーディングとは,ある要素のあるプロパティに対する宣⾔が複 数あるとき,宣⾔の“強さ”の関係を定めて,うち 1
つの宣⾔だけが有 効になるようにするしくみである。 出典: http://www.tg.rim.or.jp/~hexane/ach/lbcs/lbcs2-05.htm
©2019 giftee Inc. all rights reserved 16 DBTDBEJOH • 宣⾔の強さは仕様上決まっているものであって、コード上に明⽰さ
れない • スタイル当てても適⽤されない/思ってないところにスタイルが当 たる
ʮอकੑͷߴ͍DTTΛॻ͘ʯͷ͕͍͠ཧ༝ ͦͷDTTͷ༷ DBTDBEJOH ©2019 giftee Inc. all rights reserved 17
©2019 giftee Inc. all rights reserved 18 • Rails Developers
Meetup 2019 • CSSの技術的負債との向き合い⽅ / How to Deal with Technical Debt of CSS (ja) • https://speakerdeck.com/upinetree/how-to-deal-with- technical-debt-of-css-ja
©2019 giftee Inc. all rights reserved 19 DTTͷٕज़తෛ࠴ • cssを変更したら思っていたところと違うところに影響した
• cssがどこにどう作⽤しているか分からないので⼿を加えたくない • 指定したスタイルがなぜか適⽤されない • 使われていないcssがあるけど怖くて消せない
©2019 giftee Inc. all rights reserved 20 引⽤: CSSの技術的負債との向き合い⽅ /
How to Deal with Technical Debt of CSS (ja)
©2019 giftee Inc. all rights reserved 21 引⽤: CSSの技術的負債との向き合い⽅ /
How to Deal with Technical Debt of CSS (ja)
©2019 giftee Inc. all rights reserved 22 DTTʮؔ৺ͷ୩ʯʹଘࡏ͢Δ エンジニア •
cssは苦⼿意識があるので⼿を出しづらい デザイナー • デザインの表現⼿段の⼀つであり、構造を設計しようというモチ ベーションが湧きづらい
ʮอकੑͷߴ͍DTTΛॻ͘ʯͷ͕͍͠ཧ༝ ͦͷDTTͷཱͪҐஔ ؔ৺ͷ୩ ©2019 giftee Inc. all rights reserved 23
ʮอकੑͷߴ͍DTTΛॻ͘ʯͷ͕͍͠ཧ༝ ͦͷDTTͷ༷ DBTDBEJOH ͦͷDTTͷཱͪҐஔ ؔ৺ͷ୩ ©2019 giftee Inc. all rights
reserved 24
©2019 giftee Inc. all rights reserved 25 DTTͷ༷ DBTDBEJOH ʹཱ͔ͪ͏
• cssの設計を考えていく • 様々な設計思想がある • 「ファイルの分け⽅」と「命名規則」 • OOCSS, FLOCSS, SMACSS, RSCSS, ...etc • BEMなどの命名規則
©2019 giftee Inc. all rights reserved 26 ࠓճ࠾༻ͨ͠ͷ SMACSS •
base, layout, module, state, themeに分ける • (BEMは不採⽤) • 理由: SMACSSに命名規則が⼊っている
©2019 giftee Inc. all rights reserved 27 ʮอकੑͷߴ͍DTTΛॻ͘ʯͨΊͷΞϓϩʔν ͦͷ エンジニアがちゃんと検討する
• 何かを構造的に組み⽴てることが得意 既存の設計⽅針に乗ると良さそう • cascadingをコントロールしやすい
©2019 giftee Inc. all rights reserved 28 DTTͷཱͪҐஔ ؔ৺ͷ୩ ʹཱ͔ͪ͏
引⽤: CSSの技術的負債との向き合い⽅ / How to Deal with Technical Debt of CSS (ja)
©2019 giftee Inc. all rights reserved 29 ʮؔ৺ͷ୩ʯΛʮຒΊΔʯ • cssを、デザインを表現するための⼿段だと(雑に)捉えると・・・
• 表現対象となるデザインが(ある程度)決まりを持ったものになって いてほしい • デザインシステムの導⼊ – 決まりのあるデザイン→構造化したcssに落とし込みやすい
©2019 giftee Inc. all rights reserved 30 ʮؔ৺ͷ୩ʯΛʮຒΊΔʯ • デザインはデザイナーと⼀緒に作っていくぐらいがよいのでは
– デザインはデザイナーだけのものではない • cssを書くのはエンジニアがやったほうが多分良い – 実装レベルで構造化するのはエンジニアのほうが得意
©2019 giftee Inc. all rights reserved 31 ʮอकੑͷߴ͍DTTΛॻ͘ʯͨΊͷΞϓϩʔν ͦͷ デザインをエンジニアとデザイナーが⼀緒になって作る
お互いの得意分野を活かす
©2019 giftee Inc. all rights reserved 32 ·ͱΊ • cssは、その仕様や⽴ち位置的に保守性の⾼いものにし⾟い
• 完璧に保守性を持ったcssにするのは不可能 • でも⽴ち向かわないと何も変わらない • やっていき
©2019 giftee Inc. all rights reserved 33 Φν • 実はCSS
in JSしてしまえばこんな設計どうこうとか考えなくてい いんですけどね