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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
選挙速報を多くのユーザーへ 届ける Live Activities 設計
hamayokokuririn
0
190
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
430
Embedded Swiftで作る自作USBデバイス によるiOSデバイスの自動テスト / iOSDC Japan 2026 glassfiber
glassfiber
0
150
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
320
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.5k
iOSDCのペンライトを自動制御したい!
akkeylab
0
230
SREの越境 / SRE Collaboration
y0hgi
2
290
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
350
Verilogで学ぶCPU自作入門.pdf
uyuki234
7
3.8k
設計次第でAIコードの読む量は減らせる / designing-for-code-reading
minodriven
29
13k
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
Agents on Rails - Rails at Scale 2026
irinanazarova
0
300
Featured
See All Featured
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
540
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
850
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
540
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
5
750
Technical Leadership for Architectural Decision Making
baasie
3
580
Music & Morning Musume
bryan
48
7.4k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
3
3.8k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
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で書きま す (´・ω・`)