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 Modules
Search
Kaneko Takeshi
May 12, 2017
47
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
CSS Modules
Kaneko Takeshi
May 12, 2017
More Decks by Kaneko Takeshi
See All by Kaneko Takeshi
オープンソースライセンスについて勉強する定期
tkckaneko
0
49
Eye Tracking on the Browser
tkckaneko
0
100
IEEE754を完全に理解した
tkckaneko
1
89
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
100
多分これが一番早いと思います
tkckaneko
0
31
暗黒面の話
tkckaneko
0
31
CSR / SSR / SSG / JAMstack
tkckaneko
0
79
BOLT
tkckaneko
0
43
CSS Logical Properties and Values
tkckaneko
0
65
Featured
See All Featured
The Curious Case for Waylosing
cassininazir
1
570
Making Projects Easy
brettharned
120
6.8k
16th Malabo Montpellier Forum Presentation
akademiya2063
PRO
0
400
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
800
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
530
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
470
The Curse of the Amulet
leimatthew05
3
15k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
260
Prompt Engineering for Job Search
mfonobong
0
500
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
800
Transcript
CSS Modules
CSS Modules 知ってますか?
None
CSSの悩みを 解決するため 考え出されました
例)命名規則について
CSSはグローバルスコープのため 予期しないコンポーネントから 参照されていることもあります
BEMの場合
Block Element Modifire
.answer__button--disabled
/*** submit-button.css ***/ .answer__button--disabled { } /*** answer.html ***/ <button
class="answer__button--disabled">submit</button>
とても良くできてます しかし、クラス名を考えたり 守っていくことは大変です
CSS Modules
/*** answer-button.css ***/ .disabled { } /*** answer-button.js ***/ import
styles from './answer-button.css' buttonElem.outerHTML = `<button class=${styles.disabled}>Submit</button>`
/*** answer.html ***/ <button class="ansewer_button__bisabled__abc12345"> submit </button>
クラス名は一意になるように コンパイル時に生成されます
実際にやってみます
https://github.com/knktkc/css-modules-examples
まとめ
CSS Modulesじゃなければ ダメってことはないけど 新しい選択肢にどうぞ