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
VueでCSSモジュールを使った感想
Search
Yasushi Asahi
May 14, 2019
Programming
720
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
VueでCSSモジュールを使った感想
Yasushi Asahi
May 14, 2019
More Decks by Yasushi Asahi
See All by Yasushi Asahi
フロントエンジニアでも GKEの開発環境を作りたいっ!!
yasushiasahi
0
500
Other Decks in Programming
See All in Programming
MIZARU@SPAJAM2026 第二回予選
1901drama
0
110
GKE で Pod の見方を変えたら、スケールアウト時の挙動を真に捉えられた話
stkk
0
110
go-spidermonkeyでAIエージェントのCode Modeを実装する
syumai
3
1.5k
一参加者から『中の人』へ 〜全通PHPerがブースに立って学んだ、カンファレンスを100倍楽しむコツ〜
wp_daisuke
0
140
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
200
スマート反転とウェブアクセシビリティ
camiha
0
180
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
230
[DroidKaigi 2026] Bring your own phones to Gradle Managed Devices
f2lk
0
110
AIを上手に使っていこうとしたら越境せざるを得なくなった話 〜実践1年で見えた境界を越えなければならない理由と進め方〜 / Crossing borders with AI
tomoyakitaura
4
1.1k
ALB ログから Trace を気合で繋げる技術
fohte
7
880
初心者DevRelとして参加者だった私が、DevRel Talks!#2に登壇するまでにしてきたこと
sokohirai
0
360
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
1.7k
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
55
13k
Information Architects: The Missing Link in Design Systems
soysaucechin
1
1.1k
The Cult of Friendly URLs
andyhume
79
7k
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
340
Are puppies a ranking factor?
jonoalderson
2
3.9k
RailsConf 2023
tenderlove
30
1.5k
The agentic SEO stack - context over prompts
schlessera
0
920
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
540
Mind Mapping
helmedeiros
1
350
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.3k
Music & Morning Musume
bryan
47
7.4k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
230
23k
Transcript
プロジェクトで CSSモジュールを 使った感想
自己紹介 名前 zero 本名:旭康史(あさひやすし) 所属 カラビナテクノロジー 仕事 フロントエンド 技術 React好き(vueも好き)。Docker好き。Golang好き。 他 今期の覇権は「ひとりぼっちの◦◦生活」
ScopedParent.vue ScopedChild.vue <template> <div class="wrapper"> <h2>スコープドチャイルド</h2> </div> </template> <style scoped>
.wrapper { background-color: lime; } </style> <template> <div class="wrapper"> <h2>スコープドペアレント</h2> <ScopedChild /> </div> </template> <style scoped> .wrapper { padding: 20px; background-color: lightcyan; } </style> <div data-v-4f362c8a class="wrapper"> <h2 data-v-4f362c8a>スコープドペアレント</h2> <div data-v-0dcdfa6c data-v-4f362c8a class="wrapper"> <h2 data-v-0dcdfa6c>スコープドチャイルド</h2> </div> </div> scopedは 普通に 競合する
ModuleParent.vue ModuleChild.vue <template> <div :class="$style.wrapper"> <h2>モジュールチャイルド</h2> </div> </template> <style module>
.wrapper { background-color: lime; } </style> <template> <div :class="$style.wrapper"> <h2>モジュールペアレント</h2> <ModuleChild /> </div> </template> <style module> .wrapper { padding: 20px; background-color: lightcyan; } </style> moduleは いくぶん 安心 <div class="ModuleParent_wrapper_1qsYl"> <h2>モジュールペアレント</h2> <div class="ModuleChild_wrapper_1XBnr"> <h2>モジュールチャイルド</h2> </div> </div>
親で定義した スタイルを 子に渡せる
<template> <div :class="$style.wrapper"> <p>親</p> <div :class="$style.container"> <FirstChild :pStyle="$style" /> <SecondChild
:pStyle="$style" /> </div> </div> </template> <style module> .wrapper { padding: 10px; text-align: center; border: 1px solid indigo; } .container { display: flex; justify-content: space-around; } /* 子供用のスタイル */ .box { padding: 10px; background-color: lightgreen; } .text { text-decoration: underline; } </style> <template> <div :class="pStyle.box"> <h1 :class="pStyle.text">長男</h1> </div> </template> <template> <div :class="pStyle.box"> <h2 :class="pStyle.text">次男</h2> </div> </template> Parent.vue FirstChild.vue SecondChild.vue
moduleの嫌な所 ・いちいち $style って 書くのがめんどくさい ・クラス名がやたらと長くなって見づらい ・バインドし忘れる(:を付け忘れる) ・webpackの設定によっては 外部ライブラリのcssが崩れる。 ぶっちゃけデメリットのほうが大きい
scopedの欠点は工夫次第でどうとでも出来る!!
ありがとうございました またVueのプロジェクトや るとしたらscopedで書きま す (´・ω・`)