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
44
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
44
Eye Tracking on the Browser
tkckaneko
0
99
IEEE754を完全に理解した
tkckaneko
1
85
CSSのトレンドをみんなで見よう -2021年-
tkckaneko
0
100
多分これが一番早いと思います
tkckaneko
0
31
暗黒面の話
tkckaneko
0
31
CSR / SSR / SSG / JAMstack
tkckaneko
0
79
BOLT
tkckaneko
0
40
CSS Logical Properties and Values
tkckaneko
0
55
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
Producing Creativity
orderedlist
PRO
348
40k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
230
Believing is Seeing
oripsolob
1
180
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
35k
How to train your dragon (web standard)
notwaldorf
97
6.7k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
650
Optimizing for Happiness
mojombo
378
71k
WCS-LA-2024
lcolladotor
0
790
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
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じゃなければ ダメってことはないけど 新しい選択肢にどうぞ