SlideShare ist ein Scribd-Unternehmen logo
1 von 58
Downloaden Sie, um offline zu lesen
Custom Elements with
Polymer Web Components
John Riviello
@JohnRiv
Distinguished Engineer, Comcast Interactive Media
Elements: The Web Conference at Penn State – June 14, 2016
Polymer &
Web Components
”250/365 - Bricks" by Kenny Louie is licensed under CC BY 2.0
Why? What? How?
Communicating & shipping
web design & functionality
updates across a large
organization is HARD WORK
Communicating & Sharing Web Updates Across Your Organization
1. Living Style Guides
2. Tiny Bootstraps
3. AngularJS Directives
4. React Components
5. Web Standards?
John Riviello – Custom Elements with Polymer Web Components4
Potential Technical Solutions:
YES!
Web Standards!
Web Components!
What are
Web Components?
What are Web Components?
4 Specs
John Riviello – Custom Elements with Polymer Web Components7
What are Web Components?
Custom Elements
John Riviello – Custom Elements with Polymer Web Components8
What are Web Components?
Custom Elements
John Riviello – Custom Elements with Polymer Web Components9
•Provides a way for authors to build their own
fully-featured DOM elements.
- <xc-tab>Your Wifi</xc-tab>
•Can extend existing HTML elements
- <button is="xc-button">Edit</button>
What are Web Components?
HTML Imports
John Riviello – Custom Elements with Polymer Web Components10
What are Web Components?
HTML Imports
John Riviello – Custom Elements with Polymer Web Components11
• Means to import custom elements
- <link rel="import" href="../xc-tab/xc-tab.html">
• Can link to external resources
- <link rel="import"
href="http://polygit.org/components/paper-
toast/paper-toast.html">
What are Web Components?
Templates
John Riviello – Custom Elements with Polymer Web Components12
What are Web Components?
Templates
John Riviello – Custom Elements with Polymer Web Components13
• Used to declare fragments of HTML
- <template id="tab">
<div class="tab-content"></div>
</template>
• The element itself renders nothing
• Can be cloned and inserted in the document via
JavaScript, which will render the content
What are Web Components?
Shadow DOM
John Riviello – Custom Elements with Polymer Web Components14
What are Web Components?
Shadow DOM
John Riviello – Custom Elements with Polymer Web Components15
•Allows you to take a DOM subtree and hide it
from the document scope
•Hides CSS styles as well
•Common examples from HTML5 include:
- <select>
- <video>
- <input type="date">
Can we even use
these things?
Source: http://jonrimmer.github.io/are-we-componentized-yet/
Are We Componentized Yet?
There’s hope.
What’s better than
hope?
POLYFILLS!
*as long as there is still hope*
Web Components Polyfills
webcomponents.js
John Riviello – Custom Elements with Polymer Web Components20
•Custom Elements
•HTML Imports
•Templates
•Shadow DOM
•ES6 WeakMap
•Mutation Observers
Browser Support
• IE10 (max polyfilling)
• IE11+/Edge
• Chrome (latest)
• Firefox (latest)
• Safari 7+
• Chrome Android (latest)
• Mobile Safari (latest)
Size: 33.3kB gzipped
Web Components Polyfills
webcomponents-lite.js
John Riviello – Custom Elements with Polymer Web Components21
•Custom Elements
•HTML Imports
•Templates
•Shadow DOM
•ES6 WeakMap
•Mutation Observers
Browser Support
• IE10 (flaky)
• IE11+/Edge
• Chrome (latest)
• Firefox (latest)
• Safari 7+
• Chrome Android (latest)
• Mobile Safari (latest)
Size: 33.3kB 12.0kB gzipped
Lightweight
Web Component
Libraries
Lightweight Web Component Libraries
X-Tag 5.0kB
John Riviello – Custom Elements with Polymer Web Components23
• IE9+/Edge
• Chrome (all)
• Firefox (all)
• Safari ”Mac” (5.1+?)
• Chrome & Android 4.0+
• Mobile Safari 5+
• Opera 11+
• IE10+/Edge
• Chrome 35+
• Firefox 35+
• Safari 7+
• Chrome Android (latest?)
• Mobile Safari (latest?)
• Opera (latest)
• IE11+/Edge
• Chrome (latest)
• Firefox (latest)
• Safari 7+
• Chrome Android (latest)
• Mobile Safari 7.1+
• Opera (latest)
Bosonic 9.5kB Polymer 37.2kB
Google Polymer
What is Polymer?
1. Material Design
2. A framework
3. Required to use Web Components
John Riviello – Custom Elements with Polymer Web Components25
Polymer is NOT:
What is Polymer?
<script>
var proto = Object.create(HTMLElement.prototype),
protoElement;
proto.createdCallback = function () {
this.textContent = "I'm a proto-element.
Check out my prototype!"
};
protoElement = document.registerElement('proto-element', {
prototype: proto
});
</script>
John Riviello – Custom Elements with Polymer Web Components26
Creating a Custom Element Natively
What is Polymer?
<link rel="import"
href="bower_components/polymer/polymer.html">
<script>
Polymer({
is: "proto-element",
created: function() {
this.textContent = "I'm a proto-element.
Check out my prototype!"
}
});
</script>
John Riviello – Custom Elements with Polymer Web Components27
Creating a Polymer Custom Element
What is Polymer?
<!DOCTYPE html>
<html>
<head>
<script src="webcomponents-lite.js"></script>
<link rel="import" href="proto-element.html">
</head>
<body>
<proto-element></proto-element>
</body>
</html>
RESULT:
I'm a proto-element. Check out my prototype!
John Riviello – Custom Elements with Polymer Web Components28
Using Our Custom Element
What is Polymer?
Polymer({
is: 'my-namecard',
properties: {
myName: {
type: String
}
},
ready: function() {
this.textContent = 'Hi! My name is ' + this.myName;
}
});
<my-namecard my-name="John"></my-namecard>
RESULT:
Hi! My name is John
John Riviello – Custom Elements with Polymer Web Components29
Configuring Properties
What is Polymer?
<dom-module id="my-namecard">
<template>
<div>Hi! My name is <span>{{myName}}</span></div>
</template>
<script>
Polymer({
is: 'my-namecard',
properties: {
myName: {
type: String
}
}
});
</script>
</dom-module>
John Riviello – Custom Elements with Polymer Web Components30
Data Binding
<my-namecard my-name="John">
</my-namecard>
RESULT:
Hi! My name is John
What is Polymer?
<dom-module id="my-namecard">
<template>
<div>Hi! My name is <span>{{myName}}</span></div>
</template>
<style>
span {
font-weight: bold;
}
</style>
<script>
Polymer({
is: 'my-namecard',
…
John Riviello – Custom Elements with Polymer Web Components31
Encapsulated Styles
<my-namecard my-name="John">
</my-namecard>
<p><span>Span Text</span></p>
RESULT:
Hi! My name is John
Span Text
What is Polymer?
xc-styles/xc-styles.html:
<style is="custom-style">
:root { --si-blue-sky: #2B9CD8; }
</style>
xc-custom-element/xc-custom-element.html:
<link rel="import" href="../xc-styles/xc-styles.html">
<dom-module id="xc-custom-element">
<template>
<style>
:host { border: 1px solid var(--si-blue-sky); }
</style>
</template>
</dom-module>
John Riviello – Custom Elements with Polymer Web Components32
CSS Variables for Sharing Properties
What is Polymer?
xc-fancy-element/xc-fancy-element.html:
<style>
:host {
color: var(--xc-fancy-element-color, red);
}
</style>
xc-custom-element/xc-custom-element.html:
<link rel="import" href="../xc-fancy-element/xc-fancy-element.html">
<style is="custom-style">
xc-fancy-element {
--xc-fancy-element-color: blue;
}
</style>
<template><xc-fancy-element></xc-fancy-element></template>
John Riviello – Custom Elements with Polymer Web Components33
CSS Variables for Custom Styles
What is Polymer?
xc-fancy-element/xc-fancy-element.html:
<style>
:host {
@apply(--xc-fancy-element);
}
</style>
xc-custom-element/xc-custom-element.html:
<link rel="import" href="../xc-fancy-element/xc-fancy-element.html">
<style is="custom-style">
--xc-fancy-element: {
color: blue;
margin: 0 auto;
};
</style>
<template><xc-fancy-element></xc-fancy-element></template>
John Riviello – Custom Elements with Polymer Web Components34
Mixins for Custom Styles
What is Polymer?
• Behaviors (shared functionality)
• Events
• Gestures (up, down, tap, track)
• CLI Tools
• Built-in Test Framework
• Generated Documentation Pages
John Riviello – Custom Elements with Polymer Web Components35
Other Features Polymer Provides
Building with
Polymer
Building with Polymer
• Use someone else’s element(s)
• Build your own element(s)
• Build an entire app with Polymer
John Riviello – Custom Elements with Polymer Web Components37
How to Get Started
Using Open Source
Polymer Elements
$ bower install GITHUB/ELEMENT --save
$ bower install PolymerElements/app-route --save
https://elements.polymer-project.org
https://customelements.io
Building Your Own
Polymer Element
$ polymer help
Available Commands
build Builds an application-style project
help Shows this help message,
or help for a specific command
init Initializes a Polymer project
lint Lints the project
serve Runs the polyserve development server
test Runs web-component-tester
$ polymer init
? Which starter template would you like to use?
› element: A blank element template
application: A blank application template
shop: The "Shop" Progressive Web App demo
app-drawer-template: A starter application…
Building with Polymer
• A component should do 1 thing
• Break up into smaller components
• Component doesn’t have to be visual
• Syndicating outside of primary use
John Riviello – Custom Elements with Polymer Web Components49
Things to Consider
Building a
Polymer App
Building with Polymer
$ npm install -g polymer-cli
$ polymer init
? Which starter template would you like to use?
element: A blank element template
› application: A blank application template
shop: The "Shop" Progressive Web App demo
app-drawer-template: A starter application…
John Riviello – Custom Elements with Polymer Web Components52
Building a Polymer App
Building with Polymer
? Application name cli-demo
? Main element name cli-demo-app
? Brief description of the application App Demo
John Riviello – Custom Elements with Polymer Web Components53
Building a Polymer App
Building with Polymer
create bower.json
create index.html
create manifest.json
create README.md
create src/cli-demo-app/cli-demo-app.html
create test/cli-demo-app/cli-demo-app_test.html
John Riviello – Custom Elements with Polymer Web Components54
Building a Polymer App
Building with Polymer
Project generated!
Installing dependencies...
$ polymer serve
• Load up http://localhost:8080
John Riviello – Custom Elements with Polymer Web Components55
Building a Polymer App
Hello cli-demo-app
• View README.md for info on building & running tests
• Create additional elements
• Pull in external elements
Deploying with
Polymer
Deploying with Polymer
• HTML Import external components
• Bundle internal components
- vulcanize (gulp, grunt or standalone)
- Polymer CLI:
$ polymer build
John Riviello – Custom Elements with Polymer Web Components57
External vs. Internal
Custom Elements with Polymer Web Components
John Riviello – Custom Elements with Polymer Web Components58
Learning More
• polymer-project.org
• webcomponents.org
• Polycasts with Rob Dodson on YouTube
• 2016 Google I/O Polymer videos on YouTube
• Polymer Summit videos on YouTube
• Polymer Slack: polymer-slack.herokuapp.com
For Further Info & Feedback:
Twitter: @JohnRiv

Weitere ähnliche Inhalte

Was ist angesagt?

Web Components
Web ComponentsWeb Components
Web ComponentsFITC
 
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Spyros Ioakeimidis
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsRich Bradshaw
 
Web components
Web componentsWeb components
Web componentsGil Fink
 
Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14mattsmcnulty
 
Polymer
Polymer Polymer
Polymer jskvara
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web ComponentsFu Cheng
 
Web Components with Polymer (extra Polymer 2.0)
Web Components with Polymer (extra Polymer 2.0)Web Components with Polymer (extra Polymer 2.0)
Web Components with Polymer (extra Polymer 2.0)Dhyego Fernando
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is hereGil Fink
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components EverywhereIlia Idakiev
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Librarynaohito maeda
 
Polymer presentation in Google HQ
Polymer presentation in Google HQPolymer presentation in Google HQ
Polymer presentation in Google HQHarshit Pandey
 
Web Components
Web ComponentsWeb Components
Web ComponentsFITC
 
Razor into the Razor'verse
Razor into the Razor'verseRazor into the Razor'verse
Razor into the Razor'verseEd Charbeneau
 
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17GreeceJS
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationAndrew Rota
 

Was ist angesagt? (20)

Web Components
Web ComponentsWeb Components
Web Components
 
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014Polymer - Welcome to the Future @ PyGrunn 08/07/2014
Polymer - Welcome to the Future @ PyGrunn 08/07/2014
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Web components
Web componentsWeb components
Web components
 
Web Components
Web ComponentsWeb Components
Web Components
 
Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14Polymer & the web components revolution 6:25:14
Polymer & the web components revolution 6:25:14
 
Polymer
Polymer Polymer
Polymer
 
Introduction to Web Components
Introduction to Web ComponentsIntroduction to Web Components
Introduction to Web Components
 
Web Components with Polymer (extra Polymer 2.0)
Web Components with Polymer (extra Polymer 2.0)Web Components with Polymer (extra Polymer 2.0)
Web Components with Polymer (extra Polymer 2.0)
 
Web components the future is here
Web components   the future is hereWeb components   the future is here
Web components the future is here
 
Web Components Everywhere
Web Components EverywhereWeb Components Everywhere
Web Components Everywhere
 
Polymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill LibraryPolymer, A Web Component Polyfill Library
Polymer, A Web Component Polyfill Library
 
Polymer presentation in Google HQ
Polymer presentation in Google HQPolymer presentation in Google HQ
Polymer presentation in Google HQ
 
Polymer
PolymerPolymer
Polymer
 
Web Components
Web ComponentsWeb Components
Web Components
 
Razor into the Razor'verse
Razor into the Razor'verseRazor into the Razor'verse
Razor into the Razor'verse
 
Introduction to polymer project
Introduction to polymer projectIntroduction to polymer project
Introduction to polymer project
 
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
The rise of Polymer and Web Components (Kostas Karolemeas) - GreeceJS #17
 
Web Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing CombinationWeb Components + Backbone: a Game-Changing Combination
Web Components + Backbone: a Game-Changing Combination
 
Blazor Full-Stack
Blazor Full-StackBlazor Full-Stack
Blazor Full-Stack
 

Andere mochten auch

Case study - Google's Polymer web components let us develop tomorrow's digita...
Case study - Google's Polymer web components let us develop tomorrow's digita...Case study - Google's Polymer web components let us develop tomorrow's digita...
Case study - Google's Polymer web components let us develop tomorrow's digita...Henry D Amm
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type scriptGil Fink
 
Principios de Diseño de Componentes Web
Principios de Diseño de Componentes WebPrincipios de Diseño de Componentes Web
Principios de Diseño de Componentes WebJavier Vélez Reyes
 
Summer trainingvlsi design-2011
Summer trainingvlsi design-2011Summer trainingvlsi design-2011
Summer trainingvlsi design-2011dkhari
 
Summer trainingsoftware 2011
Summer trainingsoftware 2011Summer trainingsoftware 2011
Summer trainingsoftware 2011dkhari
 
Sportconomy Tutorial
Sportconomy TutorialSportconomy Tutorial
Sportconomy TutorialSportconomy
 
CéGtaláLó éS CéGbank
CéGtaláLó éS CéGbankCéGtaláLó éS CéGbank
CéGtaláLó éS CéGbankJulcsilany
 
The Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceThe Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceJohn Riviello
 
Robert Milich\'s Sample Portfolio
Robert Milich\'s Sample PortfolioRobert Milich\'s Sample Portfolio
Robert Milich\'s Sample Portfoliormilich
 
Как запустить стартап Free
Как запустить стартап FreeКак запустить стартап Free
Как запустить стартап FreeNata Isaevich
 
Project New Hope Description
Project New Hope DescriptionProject New Hope Description
Project New Hope DescriptionBruceBillington
 
3.dev meetup2 visualforce_sites_a_pruzan
3.dev meetup2 visualforce_sites_a_pruzan3.dev meetup2 visualforce_sites_a_pruzan
3.dev meetup2 visualforce_sites_a_pruzanNata Isaevich
 
Chicora Introduction
Chicora IntroductionChicora Introduction
Chicora Introductionchicora
 
Desde el cielo
Desde el cieloDesde el cielo
Desde el cielodeliaa
 
Visual Resume of Marc Campman
Visual Resume of Marc CampmanVisual Resume of Marc Campman
Visual Resume of Marc CampmanMarc Campman
 

Andere mochten auch (20)

Case study - Google's Polymer web components let us develop tomorrow's digita...
Case study - Google's Polymer web components let us develop tomorrow's digita...Case study - Google's Polymer web components let us develop tomorrow's digita...
Case study - Google's Polymer web components let us develop tomorrow's digita...
 
End to-end apps with type script
End to-end apps with type scriptEnd to-end apps with type script
End to-end apps with type script
 
Web components
Web componentsWeb components
Web components
 
Principios de Diseño de Componentes Web
Principios de Diseño de Componentes WebPrincipios de Diseño de Componentes Web
Principios de Diseño de Componentes Web
 
Dc Motors
Dc MotorsDc Motors
Dc Motors
 
Summer trainingvlsi design-2011
Summer trainingvlsi design-2011Summer trainingvlsi design-2011
Summer trainingvlsi design-2011
 
Summer trainingsoftware 2011
Summer trainingsoftware 2011Summer trainingsoftware 2011
Summer trainingsoftware 2011
 
Memorial Presentation
Memorial PresentationMemorial Presentation
Memorial Presentation
 
Sportconomy Tutorial
Sportconomy TutorialSportconomy Tutorial
Sportconomy Tutorial
 
Presentacio Caillou 2 Cati
Presentacio Caillou 2 CatiPresentacio Caillou 2 Cati
Presentacio Caillou 2 Cati
 
CéGtaláLó éS CéGbank
CéGtaláLó éS CéGbankCéGtaláLó éS CéGbank
CéGtaláLó éS CéGbank
 
The Truth About Your Web App's Performance
The Truth About Your Web App's PerformanceThe Truth About Your Web App's Performance
The Truth About Your Web App's Performance
 
Robert Milich\'s Sample Portfolio
Robert Milich\'s Sample PortfolioRobert Milich\'s Sample Portfolio
Robert Milich\'s Sample Portfolio
 
Как запустить стартап Free
Как запустить стартап FreeКак запустить стартап Free
Как запустить стартап Free
 
Project New Hope Description
Project New Hope DescriptionProject New Hope Description
Project New Hope Description
 
3.dev meetup2 visualforce_sites_a_pruzan
3.dev meetup2 visualforce_sites_a_pruzan3.dev meetup2 visualforce_sites_a_pruzan
3.dev meetup2 visualforce_sites_a_pruzan
 
Chicora Introduction
Chicora IntroductionChicora Introduction
Chicora Introduction
 
Desde el cielo
Desde el cieloDesde el cielo
Desde el cielo
 
ICRI Urban IoT
ICRI Urban IoTICRI Urban IoT
ICRI Urban IoT
 
Visual Resume of Marc Campman
Visual Resume of Marc CampmanVisual Resume of Marc Campman
Visual Resume of Marc Campman
 

Ähnlich wie Custom Elements with Polymer Web Components #econfpsu16

Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveJohn Riviello
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereJohn Riviello
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereJohn Riviello
 
Introduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConIntroduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConJohn Riviello
 
Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer John Riviello
 
Intro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsIntro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsManuel Carrasco Moñino
 
Ensuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsEnsuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsJohn Riviello
 
Polymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaPolymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaJohn Riviello
 
Components Approach to building Web Apps
Components Approach to building Web AppsComponents Approach to building Web Apps
Components Approach to building Web AppsVinci Rufus
 
Open Apereo - Web components workshop
Open Apereo - Web components workshopOpen Apereo - Web components workshop
Open Apereo - Web components workshopbtopro
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Chris Danford
 
Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015Codemotion
 
Meteor + Polymer
Meteor + PolymerMeteor + Polymer
Meteor + Polymerwolf4ood
 
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Perficient, Inc.
 
Intro to MontageJS
Intro to MontageJSIntro to MontageJS
Intro to MontageJSRyan Paul
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERENadav Mary
 
JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!_Dewy_
 
Intro to polymer-Devfest Yaoundé 2013
Intro to polymer-Devfest Yaoundé 2013Intro to polymer-Devfest Yaoundé 2013
Intro to polymer-Devfest Yaoundé 2013gdgyaounde
 
Web components Introduction
Web components IntroductionWeb components Introduction
Web components IntroductionEugenio Romano
 

Ähnlich wie Custom Elements with Polymer Web Components #econfpsu16 (20)

Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS InteractiveIntroduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS Interactive
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Introduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebConIntroduction to Web Components & Polymer Workshop - U of I WebCon
Introduction to Web Components & Polymer Workshop - U of I WebCon
 
Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer Workshop: Introduction to Web Components & Polymer
Workshop: Introduction to Web Components & Polymer
 
Intro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin ElementsIntro to Web Components, Polymer & Vaadin Elements
Intro to Web Components, Polymer & Vaadin Elements
 
Ensuring Design Standards with Web Components
Ensuring Design Standards with Web ComponentsEnsuring Design Standards with Web Components
Ensuring Design Standards with Web Components
 
Polymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest FloridaPolymer-Powered Design Systems - DevFest Florida
Polymer-Powered Design Systems - DevFest Florida
 
Components Approach to building Web Apps
Components Approach to building Web AppsComponents Approach to building Web Apps
Components Approach to building Web Apps
 
Open Apereo - Web components workshop
Open Apereo - Web components workshopOpen Apereo - Web components workshop
Open Apereo - Web components workshop
 
Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21Web Components at Scale, HTML5DevConf 2014-10-21
Web Components at Scale, HTML5DevConf 2014-10-21
 
Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015Meteor - Codemotion Rome 2015
Meteor - Codemotion Rome 2015
 
Meteor + Polymer
Meteor + PolymerMeteor + Polymer
Meteor + Polymer
 
Polymer
PolymerPolymer
Polymer
 
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
Dart Past Your Competition by Getting Your Digital Experience into Market Fas...
 
Intro to MontageJS
Intro to MontageJSIntro to MontageJS
Intro to MontageJS
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
 
JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!JEE Conf 2015: Less JS!
JEE Conf 2015: Less JS!
 
Intro to polymer-Devfest Yaoundé 2013
Intro to polymer-Devfest Yaoundé 2013Intro to polymer-Devfest Yaoundé 2013
Intro to polymer-Devfest Yaoundé 2013
 
Web components Introduction
Web components IntroductionWeb components Introduction
Web components Introduction
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Kürzlich hochgeladen (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Custom Elements with Polymer Web Components #econfpsu16

  • 1. Custom Elements with Polymer Web Components John Riviello @JohnRiv Distinguished Engineer, Comcast Interactive Media Elements: The Web Conference at Penn State – June 14, 2016
  • 2. Polymer & Web Components ”250/365 - Bricks" by Kenny Louie is licensed under CC BY 2.0 Why? What? How?
  • 3. Communicating & shipping web design & functionality updates across a large organization is HARD WORK
  • 4. Communicating & Sharing Web Updates Across Your Organization 1. Living Style Guides 2. Tiny Bootstraps 3. AngularJS Directives 4. React Components 5. Web Standards? John Riviello – Custom Elements with Polymer Web Components4 Potential Technical Solutions:
  • 7. What are Web Components? 4 Specs John Riviello – Custom Elements with Polymer Web Components7
  • 8. What are Web Components? Custom Elements John Riviello – Custom Elements with Polymer Web Components8
  • 9. What are Web Components? Custom Elements John Riviello – Custom Elements with Polymer Web Components9 •Provides a way for authors to build their own fully-featured DOM elements. - <xc-tab>Your Wifi</xc-tab> •Can extend existing HTML elements - <button is="xc-button">Edit</button>
  • 10. What are Web Components? HTML Imports John Riviello – Custom Elements with Polymer Web Components10
  • 11. What are Web Components? HTML Imports John Riviello – Custom Elements with Polymer Web Components11 • Means to import custom elements - <link rel="import" href="../xc-tab/xc-tab.html"> • Can link to external resources - <link rel="import" href="http://polygit.org/components/paper- toast/paper-toast.html">
  • 12. What are Web Components? Templates John Riviello – Custom Elements with Polymer Web Components12
  • 13. What are Web Components? Templates John Riviello – Custom Elements with Polymer Web Components13 • Used to declare fragments of HTML - <template id="tab"> <div class="tab-content"></div> </template> • The element itself renders nothing • Can be cloned and inserted in the document via JavaScript, which will render the content
  • 14. What are Web Components? Shadow DOM John Riviello – Custom Elements with Polymer Web Components14
  • 15. What are Web Components? Shadow DOM John Riviello – Custom Elements with Polymer Web Components15 •Allows you to take a DOM subtree and hide it from the document scope •Hides CSS styles as well •Common examples from HTML5 include: - <select> - <video> - <input type="date">
  • 16. Can we even use these things?
  • 19. POLYFILLS! *as long as there is still hope*
  • 20. Web Components Polyfills webcomponents.js John Riviello – Custom Elements with Polymer Web Components20 •Custom Elements •HTML Imports •Templates •Shadow DOM •ES6 WeakMap •Mutation Observers Browser Support • IE10 (max polyfilling) • IE11+/Edge • Chrome (latest) • Firefox (latest) • Safari 7+ • Chrome Android (latest) • Mobile Safari (latest) Size: 33.3kB gzipped
  • 21. Web Components Polyfills webcomponents-lite.js John Riviello – Custom Elements with Polymer Web Components21 •Custom Elements •HTML Imports •Templates •Shadow DOM •ES6 WeakMap •Mutation Observers Browser Support • IE10 (flaky) • IE11+/Edge • Chrome (latest) • Firefox (latest) • Safari 7+ • Chrome Android (latest) • Mobile Safari (latest) Size: 33.3kB 12.0kB gzipped
  • 23. Lightweight Web Component Libraries X-Tag 5.0kB John Riviello – Custom Elements with Polymer Web Components23 • IE9+/Edge • Chrome (all) • Firefox (all) • Safari ”Mac” (5.1+?) • Chrome & Android 4.0+ • Mobile Safari 5+ • Opera 11+ • IE10+/Edge • Chrome 35+ • Firefox 35+ • Safari 7+ • Chrome Android (latest?) • Mobile Safari (latest?) • Opera (latest) • IE11+/Edge • Chrome (latest) • Firefox (latest) • Safari 7+ • Chrome Android (latest) • Mobile Safari 7.1+ • Opera (latest) Bosonic 9.5kB Polymer 37.2kB
  • 25. What is Polymer? 1. Material Design 2. A framework 3. Required to use Web Components John Riviello – Custom Elements with Polymer Web Components25 Polymer is NOT:
  • 26. What is Polymer? <script> var proto = Object.create(HTMLElement.prototype), protoElement; proto.createdCallback = function () { this.textContent = "I'm a proto-element. Check out my prototype!" }; protoElement = document.registerElement('proto-element', { prototype: proto }); </script> John Riviello – Custom Elements with Polymer Web Components26 Creating a Custom Element Natively
  • 27. What is Polymer? <link rel="import" href="bower_components/polymer/polymer.html"> <script> Polymer({ is: "proto-element", created: function() { this.textContent = "I'm a proto-element. Check out my prototype!" } }); </script> John Riviello – Custom Elements with Polymer Web Components27 Creating a Polymer Custom Element
  • 28. What is Polymer? <!DOCTYPE html> <html> <head> <script src="webcomponents-lite.js"></script> <link rel="import" href="proto-element.html"> </head> <body> <proto-element></proto-element> </body> </html> RESULT: I'm a proto-element. Check out my prototype! John Riviello – Custom Elements with Polymer Web Components28 Using Our Custom Element
  • 29. What is Polymer? Polymer({ is: 'my-namecard', properties: { myName: { type: String } }, ready: function() { this.textContent = 'Hi! My name is ' + this.myName; } }); <my-namecard my-name="John"></my-namecard> RESULT: Hi! My name is John John Riviello – Custom Elements with Polymer Web Components29 Configuring Properties
  • 30. What is Polymer? <dom-module id="my-namecard"> <template> <div>Hi! My name is <span>{{myName}}</span></div> </template> <script> Polymer({ is: 'my-namecard', properties: { myName: { type: String } } }); </script> </dom-module> John Riviello – Custom Elements with Polymer Web Components30 Data Binding <my-namecard my-name="John"> </my-namecard> RESULT: Hi! My name is John
  • 31. What is Polymer? <dom-module id="my-namecard"> <template> <div>Hi! My name is <span>{{myName}}</span></div> </template> <style> span { font-weight: bold; } </style> <script> Polymer({ is: 'my-namecard', … John Riviello – Custom Elements with Polymer Web Components31 Encapsulated Styles <my-namecard my-name="John"> </my-namecard> <p><span>Span Text</span></p> RESULT: Hi! My name is John Span Text
  • 32. What is Polymer? xc-styles/xc-styles.html: <style is="custom-style"> :root { --si-blue-sky: #2B9CD8; } </style> xc-custom-element/xc-custom-element.html: <link rel="import" href="../xc-styles/xc-styles.html"> <dom-module id="xc-custom-element"> <template> <style> :host { border: 1px solid var(--si-blue-sky); } </style> </template> </dom-module> John Riviello – Custom Elements with Polymer Web Components32 CSS Variables for Sharing Properties
  • 33. What is Polymer? xc-fancy-element/xc-fancy-element.html: <style> :host { color: var(--xc-fancy-element-color, red); } </style> xc-custom-element/xc-custom-element.html: <link rel="import" href="../xc-fancy-element/xc-fancy-element.html"> <style is="custom-style"> xc-fancy-element { --xc-fancy-element-color: blue; } </style> <template><xc-fancy-element></xc-fancy-element></template> John Riviello – Custom Elements with Polymer Web Components33 CSS Variables for Custom Styles
  • 34. What is Polymer? xc-fancy-element/xc-fancy-element.html: <style> :host { @apply(--xc-fancy-element); } </style> xc-custom-element/xc-custom-element.html: <link rel="import" href="../xc-fancy-element/xc-fancy-element.html"> <style is="custom-style"> --xc-fancy-element: { color: blue; margin: 0 auto; }; </style> <template><xc-fancy-element></xc-fancy-element></template> John Riviello – Custom Elements with Polymer Web Components34 Mixins for Custom Styles
  • 35. What is Polymer? • Behaviors (shared functionality) • Events • Gestures (up, down, tap, track) • CLI Tools • Built-in Test Framework • Generated Documentation Pages John Riviello – Custom Elements with Polymer Web Components35 Other Features Polymer Provides
  • 37. Building with Polymer • Use someone else’s element(s) • Build your own element(s) • Build an entire app with Polymer John Riviello – Custom Elements with Polymer Web Components37 How to Get Started
  • 39. $ bower install GITHUB/ELEMENT --save $ bower install PolymerElements/app-route --save
  • 43.
  • 44. $ polymer help Available Commands build Builds an application-style project help Shows this help message, or help for a specific command init Initializes a Polymer project lint Lints the project serve Runs the polyserve development server test Runs web-component-tester
  • 45. $ polymer init ? Which starter template would you like to use? › element: A blank element template application: A blank application template shop: The "Shop" Progressive Web App demo app-drawer-template: A starter application…
  • 46.
  • 47.
  • 48.
  • 49. Building with Polymer • A component should do 1 thing • Break up into smaller components • Component doesn’t have to be visual • Syndicating outside of primary use John Riviello – Custom Elements with Polymer Web Components49 Things to Consider
  • 51.
  • 52. Building with Polymer $ npm install -g polymer-cli $ polymer init ? Which starter template would you like to use? element: A blank element template › application: A blank application template shop: The "Shop" Progressive Web App demo app-drawer-template: A starter application… John Riviello – Custom Elements with Polymer Web Components52 Building a Polymer App
  • 53. Building with Polymer ? Application name cli-demo ? Main element name cli-demo-app ? Brief description of the application App Demo John Riviello – Custom Elements with Polymer Web Components53 Building a Polymer App
  • 54. Building with Polymer create bower.json create index.html create manifest.json create README.md create src/cli-demo-app/cli-demo-app.html create test/cli-demo-app/cli-demo-app_test.html John Riviello – Custom Elements with Polymer Web Components54 Building a Polymer App
  • 55. Building with Polymer Project generated! Installing dependencies... $ polymer serve • Load up http://localhost:8080 John Riviello – Custom Elements with Polymer Web Components55 Building a Polymer App Hello cli-demo-app • View README.md for info on building & running tests • Create additional elements • Pull in external elements
  • 57. Deploying with Polymer • HTML Import external components • Bundle internal components - vulcanize (gulp, grunt or standalone) - Polymer CLI: $ polymer build John Riviello – Custom Elements with Polymer Web Components57 External vs. Internal
  • 58. Custom Elements with Polymer Web Components John Riviello – Custom Elements with Polymer Web Components58 Learning More • polymer-project.org • webcomponents.org • Polycasts with Rob Dodson on YouTube • 2016 Google I/O Polymer videos on YouTube • Polymer Summit videos on YouTube • Polymer Slack: polymer-slack.herokuapp.com For Further Info & Feedback: Twitter: @JohnRiv