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
Bower + WebComponents
Search
mex-ichikawa
October 24, 2014
Programming
0
27
Bower + WebComponents
WebComponentsのパッケージ化について。。。
mex-ichikawa
October 24, 2014
Tweet
Share
More Decks by mex-ichikawa
See All by mex-ichikawa
Three.js vs Unity5
mex_ichikawa
0
53
WebAudioAPIで(目的の)SE作れなかった話
mex_ichikawa
0
30
gulp + React
mex_ichikawa
2
380
Blob URL Scheme
mex_ichikawa
0
400
Other Decks in Programming
See All in Programming
"config" ってなんだ? / What is "config"?
okashoi
0
230
Folding Cheat Sheet #3
philipschwarz
PRO
0
120
DMMプラットフォームがTiDB Cloudを採用した背景
pospome
8
3.9k
MicrosoftのPlatform Engineeringガイドを読んで実際になにかやってみた
ymd65536
1
180
Changed Rules: Architectures with Lightweight Stores
manfredsteyer
PRO
0
230
Ruby GitHub Packages
bkuhlmann
0
630
ADRを一年運用してみた/adr_after_a_year
hanhan1978
7
2.3k
0→1と1→10の狭間で Javaという技術選定を振り返る/Reflecting on the Decision to Choose Java Between Scaling from 0 to 1 and 1 to 10
jaguar_imo
2
380
Hanami and htmx
bkuhlmann
0
200
try! Swift Tokyo 2024のLT枠に採択されたプロポーザルを出すときに考えていたこと
ski
0
340
SwiftUIで使いやすいToastの作り方 / How to build a Toast system which is easy to use in SwiftUI
lovee
3
130
Site Reliability Engineering for GMO
pyama86
7
1k
Featured
See All Featured
Building Your Own Lightsaber
phodgson
98
5.7k
A Modern Web Designer's Workflow
chriscoyier
688
190k
Large-scale JavaScript Application Architecture
addyosmani
503
110k
Being A Developer After 40
akosma
56
580k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
124
32k
Atom: Resistance is Futile
akmur
258
25k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Build The Right Thing And Hit Your Dates
maggiecrowley
23
2k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
501
140k
Into the Great Unknown - MozCon
thekraken
10
990
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
15
1.4k
From Idea to $5000 a Month in 5 Months
shpigford
377
45k
Transcript
Bower + WebComponents @ichikawa Tsukiji.front - 2014/10/24
パッケージ管理ツール
• Component - https://github.com/componentjs/component • Bower - http://bower.io/ • RequireJS
- http://requirejs.org/ • Browserify - http://browserify.org/
• Component - https://github.com/componentjs/component • Bower - http://bower.io/ • RequireJS
- http://requirejs.org/ • Browserify - http://browserify.org/
普段使ってるBowerで!
とりあえずColorPickerを作る
ソースをコンポーネント化
ソースをコンポーネント化
まずは、 シンプルなテンプレコード で実行
createdCallback: { value: function(){ var shadowRoot = this.createShadowRoot(); var template
= document.querySelector('#nameOfTemplate'); shadowRoot.appendChild(template.content.cloneNode(true)); } }
templateが読めない。。。
//global var currentDocument = document.currentScript.ownerDocument; ... createdCallback: { value: function(){
var shadowRoot = this.createShadowRoot(); var template = currentDocument.querySelector('#nameOfTemplate'); shadowRoot.appendChild(template.content.cloneNode(true)); } }
読めるようになった!
作成コードをはめ込む
• テンプレートがShadowRoot内に入るのでセレクタ注意 • 画像などのアセットパスの扱いをどうするか、今回は埋め込んだ
githubにpush
bowerに登録 bower register [パッケージ名] [パッケージリポジトリパス ]
別プロジェクトで利用 DEMO
ホントは配置までやりたかった 次の機会に。。。
おわり