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
CSS Modules
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kaneko Takeshi
May 12, 2017
43
0
Share
CSS Modules
Kaneko Takeshi
May 12, 2017
More Decks by Kaneko Takeshi
See All by Kaneko Takeshi
オープンソースライセンスについて勉強する定期
tkckaneko
0
35
Eye Tracking on the Browser
tkckaneko
0
91
IEEE754を完全に理解した
tkckaneko
1
79
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
97
多分これが一番早いと思います
tkckaneko
0
28
暗黒面の話
tkckaneko
0
27
CSR / SSR / SSG / JAMstack
tkckaneko
0
74
BOLT
tkckaneko
0
33
CSS Logical Properties and Values
tkckaneko
0
39
Featured
See All Featured
Embracing the Ebb and Flow
colly
88
5k
The browser strikes back
jonoalderson
0
880
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.4k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
2
660
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
190
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
420
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9k
Between Models and Reality
mayunak
3
260
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じゃなければ ダメってことはないけど 新しい選択肢にどうぞ