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
RiotJS + CSS #meguroes
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
mizuki_r
April 19, 2016
Technology
750
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
RiotJS + CSS #meguroes
Meguro.es #3 でのトーク内容です
mizuki_r
April 19, 2016
Transcript
35 slides
RiotJSͱCSS 2016/04/19 Meguro.es #3 @mizuki_r
PROFILE @mizuki_r 5XJUUFS!NJ[VLJ@S (JUIVCSZ@NJ[VLJ OQNNJ[VLJ@S "OHVMBS 3JPU+4·ΘΓͷ͍ख (PUBOEB+4͔Β͖ͬͯ·ͨ͠ 2
AGENDA ▸ RiotJSͱ ▸ RiotJS + CSS ▸ RiotJS +
CSS + Webpack ▸ Conclusion
RIOTJSͱ INTRODUCTION
RIOTJSͱ A React-like user interface micro-library ▸ ReactͬΆ͍খ͞ͳUIϥΠϒϥϦ ▸ React͕38.56KBͰRiot͕8.61KBʢhttp://riotjs.com/ja/
▸ API͕গͳ͘ɺֶशίετ͕͍ ▸ ඞཁ࠷ݶͷػೳͷΈͰߏ͞ΕͨɺϛχϚϜελʔτΞο ϓͳײ͡ͷϥΠϒϥϦ
<todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={
item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo>
<todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={
item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo> ίϯϙʔωϯτΛఆٛ
<todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={
item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo> DOMͷఆٛ
<todo> <!-- layout --> <h3>{ opts.title }</h3> <ul> <li each={
item, i in items }>{ item }</li> </ul> <form onsubmit={ add }> <input> <button>Add #{ items.length + 1 }</button> </form> <!-- logic --> <script> this.items = [] add(e) { var input = e.target[0] this.items.push(input.value) input.value = '' } </script> <todo> ৼΔ͍ͷఆٛ
RIOTJSͱ ؆୯ʹ͑Δখ͞ͳϥΠϒϥϦ ▸ JavaScript in HTML ▸ গͳ͍API ▸ lifecycle
(mount, update, updated, unmount) ▸ update ▸ yield ▸ dom events
RIOTJSͱ ·ͱΊ ▸ খͯ͘͞खૣ࢝͘ΊΒΕΔϛχϚϜͳUIϥΠϒϥϦ
RIOTJS+CSS RIOTJSʹ͓͚ΔCSSͷར༻ํ๏
RIOTJS + CSS CSSͷهड़ ▸ λάͷதʹ `<style>` Λهड़͢Δ ▸ `<style>`
ͷதʹCSSΛهड़͢Δ
RIOTJS + CSS CSSͷهड़ <todo> <!-- layout --> <h3>{ opts.title
}</h3> <style> todo { display: block } todo h3 { font-size: 120% } </style> <todo>
RIOTJS + CSS Scoped CSSͷهड़ ▸ λάͷதʹ `<style scoped>` Λهड़͢Δ
▸ `<style>` ͷதʹCSSΛهड़͢Δ ▸ `:scope` ͷٖࣅཁૉʹελΠϧΛͯΔ
RIOTJS + CSS Scoped CSSͷهड़ <todo> <!-- layout --> <h3>{
opts.title }</h3> <style scoped> scope: { display: block } h3 { font-size: 120% } </style> <todo>
RIOTJS + CSS λάΛϕʔεͱͨ͠ελΠϦϯά ▸ ͜ͷ̎ͭͷॻ͖ํಉ݁͡ՌʹͳΔ <todo> <!-- layout -->
<h3>{ opts.title }</h3> <style> todo { display: block } todo h3 { font-size: 120% } </style> <todo> <todo> <!-- layout --> <h3>{ opts.title }</h3> <style scoped> scope: { display: block } h3 { font-size: 120% } </style> <todo>
RIOTJS + CSS headλάͷૠೖ ▸ λάͷ෦ʹهࡌ͞Εͨ `<style>` `<head>` ͷඌʹૠ
ೖ͞ΕΔ ▸ Ұૠೖ͞ΕͨΒɺ࠶ૠೖ͞Εͳ͍ ▸ shadow-domͰͳ͍͕ɺ͍ۙΞϓϩʔνΛऔΔ
RIOTJS + CSS ·ͱΊ ▸ λάͷதʹ `<style>` Λهड़͠ɺͦ͜ʹCSSΛॻ͘ ▸ `<style>`
`<head>` ͷඌʹૠೖ͞ΕΔ ▸ `<style scoped>` Λ͏͜ͱͰɺλά໊ͷهࡌΛলུͰ͖Δ
RIOTJS+CSS+WEBPACK CSSϥΠϒϥϦͱͷ࿈ܞ
RIOTJS + CSS + WEBPACK CSS༷ʑͳϥΠϒϥϦʹࢧ͑ΒΕ͍ͯΔ ▸ autoprefixer ▸ meta
css ▸ postcss ▸ etc… ͜ΕΒͷԸܙΛ͋·ͣ͞ड͚͍ͨ!!!
RIOTJS + CSS + WEBPACK webpackͷར༻ ▸ հলུ ▸ riotjs-loader
+ style-loader + css-loader + anywhere
RIOTJS + CSS + WEBPACK webpackͷར༻ module: { preLoaders: [
{ test: /\.tag$/, exclude: /node_modules/, loader: 'riotjs- loader' }, ], loaders: [ { test: /\.css$/, exclude: /node_modules/, loader: 'style-loader! css-loader!postcss-loader' } ] }, postcss: () -> return [ require('postcss-calc') require('postcss-nested') require('autoprefixer') ]
RIOTJS + CSS + WEBPACK webpackͷར༻ var style = require(‘./style’)
<todo> <!-- layout --> <h3>{ opts.title }</h3> <style>{ style }</style> <todo>
RIOTJS + CSS + WEBPACK webpackΛ͏ϝϦοτ ▸ λάͷఆٛͱɺελΠϧͷఆٛΛҰॹʹཧͰ͖Δ ▸ σΟϨΫτϦʹࠝแͰ͖Δ
▸ ίϯϙʔωϯτͱͯ͠ɺใઃܭɾৼΔ͍ɾσβΠϯ͕ಠ ཱ͠ɺΞϓϦέʔγϣϯ͔Βૄ݁߹ʹͳΔ
RIOTJS + CSS + WEBPACK ·ͱΊ ▸ webpack͏ͱ͍͍Αʂ ▸ webpackΛ͏ͱίϯϙʔωϯτʹσβΠϯ·ͰแͰ͖
Δ ▸ ΞϓϦέʔγϣϯͱίϯϙʔωϯτΛૄʹͰ͖Δ
CONCLUSION ·ͱΊͱɺ͜Ε͔ΒͷCSSઃܭ
CONCLUSION RiotJSͱCSSΛ͍͍ײ͡ʹ࿈ܞͤ͞Δํ๏ͷհ ▸ RiotJSͰCSSΛ͏ʹɺλάʹ `<style>` Λॻ͘ ▸ `<style>` ʹهࡌ͞ΕͨCSS `<head>`
ͷඌʹૠೖ ▸ webpackΛͬͯίϯϙʔωϯτʹσβΠϯΛ࣋ͨͤΔ
CONCLUSION ίϯϙʔωϯτࢦ࣌ͷCSSઃܭ ▸ ίϯϙʔωϯτʹελΠϧΛӅṭ͢Δ࣌ ▸ λάʹରͯ͠ελΠϧΛͯΔ ▸ ˠࢠʹରͯ͠ɺmodifierͰίϯϙʔωϯτ֎͔Β ෦ߏΛҙࣝ͠ͳ͍ૄ݁߹ͳελΠϧ੍ޚ ▸
ίϯϙʔωϯτͱͯ͠ใઃܭɾৼΔ͍ɾσβΠϯΛந Խ͢Δ͜ͱͰɺͦΕ୯ମͷࠩ͠ସ͑ΛΑΓ؆୯ʹ
CONCLUSION ࠓޙͷ՝ ▸ ίϯϙʔωϯτͲ͜·ͰͷσβΠϯΛ͖͔࣋ͭʁ ▸ ৭ʁϨΠΞτʁ༨നʁܗʁ ▸ ͜ͷลΓDDDͷʮڥքΛҾ͘ʯ͋ͨΓͷφϨοδ͕ඞ ཁͦ͏ ▸
ࠓ·ͰҎ্ʹσβΠφͱΤϯδχΞ͕ڠྗͯ͠ઃܭΛ٧Ίͯ ͍͘ඞཁ͕͋Γͦ͏
CONCLUSION ࠷ޙʹ ▸ RiotJS؆୯ʹखૣ͘ϓϩτλΠϐϯάͰ͖ΔͷͰ͓͢͢Ί Ͱ͢ʂʂʂ
ۓٸࠂ ͨ͐͝͡ʔ͔Βͷ͓Βͤ
6/3ʹGontanda.js #4 ͷ։ ࠵Λ༧ఆͯ͠·͢ʂ @pine613 ͨ͐͝͡ʔ͔Βͷ͓Βͤ
ڵຯ͋Δํͥͻ gotanda.js.org ʂ @pine613 ͨ͐͝͡ʔ͔Βͷ͓Βͤ
THANKS!
More Decks by mizuki_r
See All by mizuki_r
FrontendUp_新規事業で_Remixを採用した理由と対策.pdf
rymizuki
0
270
税理士ドットコムの 技術的挑戦 #tapioca_lt
rymizuki
0
330
PHPを始めて1年、レガシーシステムにどう向き合っているか #phpstudy
rymizuki
1
880
モダンとレガシー #gotandaem
rymizuki
0
610
Vuexに型を付けるパターンを調べた #gotandajs
rymizuki
0
160
DockerでNodeの開発は厳しいのか? #gotandajs
rymizuki
3
440
マネージャー!きみは何者だ! #gotandaem
rymizuki
0
1.9k
物語を楽しむための物語論
rymizuki
0
580
失敗と向き合う
rymizuki
0
1.6k
Other Decks in Technology
See All in Technology
統制されたID・権限をどう利用するか : DPoP/FAPIによるAPIセキュリティ強化
oidfj
1
230
3文字略語に騙されない! 世界一わかりやすい『EDR』超入門
kamadamakoto
1
280
エンタープライズIAMについて - ID・権限をどう統制するか
oidfj
1
250
変更差分を読むために環境を整備しよう
pipepasta
1
480
Well, that’s weird…
csswizardry
1
130
kubellの最新データ分析環境
kubell_hr
2
200
Platform Engineering をベースとした Agentic Software Factory の実践
110y
1
430
20261113_JAWS_Osaka
takuyay0ne
1
600
さようならSSH鍵、こんにちはゼロトラスト ― AIフレンドリーで快適な自宅鯖SSH
atalie2m
14
7.3k
[NW-JAWS DAY]「うちのAWS、インターネット出られないんで」― AWS外の自社サービスをPrivateLinkでシュッと公開する方法
ykimi
3
900
みん強Lightning! データ基盤ひとりでできるかな
endonanana
0
120
AWS Blocksで AIエージェント作れるの知ってます?
kmiya84377
1
130
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.3k
The Power of CSS Pseudo Elements
geoffreycrofte
82
6.6k
How to make the Groovebox
asonas
2
2.6k
Site-Speed That Sticks
csswizardry
13
1.6k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
6
960
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
610
How Software Deployment tools have changed in the past 20 years
geshan
3
35k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Designing for Performance
lara
612
70k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
Balancing Empowerment & Direction
lara
6
1.4k