SlideShare a Scribd company logo
Workshop:
Introduction to Web Components & Polymer
Node+JS Interactive
Wednesday, October 10, 2018 • 11:00am - 12:50pm
John Riviello
@JohnRiv
Chris Lorenzo
@Chiefcll
Workshop materials are available at:
http://tinyurl.com/
nodejsint-polymer
-workshop
WEB COMPONENTS
What Are Web Components?
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop4
… a set of web platform APIs that allow
you to create new custom, reusable,
encapsulated HTML tags to use in web
pages and web apps...
Source: https://www.webcomponents.org/introduction
What Are Web Components?
5
… [built] on the Web Component standards,
will work across modern browsers, and
can be used with any JavaScript library or
framework that works with HTML.
Source: https://www.webcomponents.org/introduction
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
6
4 Specs
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
7
Custom Elements
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
8 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
9
Custom Elements
•Provides a way for authors to build their own
fully-featured DOM elements.
<paper-tabs selected="0" scrollable>
<paper-tab>The first tab</paper-tab>
<paper-tab>Tab two</paper-tab>
<paper-tab>The third tab</paper-tab>
<paper-tab>Fourth tab</paper-tab>
</paper-tabs>
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
10
HTML Imports
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
11 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
• Means to import custom elements
- <link rel="import" href="paper-tabs.html">
• Componetize the HTML, CSS & JavaScript
• Built-in deduplication
What Are Web Components?
12
HTML Imports
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
13
Templates
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
14 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
15
• 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 quickly render the content
Templates
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
16
Shadow DOM
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
17 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What Are Web Components?
18
•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">
Shadow DOM
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
Can we even use
these things?
20
Source: https://www.webcomponents.org/
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
21
Source: https://www.webcomponents.org/
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
22
Source: https://www.webcomponents.org/
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
23 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
24 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
25 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
What’s
Google Polymer?
Google Polymer Project
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS Interactive
Introduction to Web Components & Polymer Workshop - JS Interactive
Polymer 3.0
https://www.polymer-project.org/3.0/
docs/devguide/feature-overview
Let’s code!
Codelab:
Build Google Maps using
Web Components & No Code!
tinyurl.com/comcast-polymer-map
Codelab: Build Google Maps using Web Components & No Code!
34
Codelab URL: tinyurl.com/comcast-polymer-map
Relevant Map Data:
•latitude="49.2892"
•longitude="-123.1169"
•start-address="1055 Canada Place"
•end-address="TELUS Garden"
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
Takeaways!
Intro to Web Components & Polymer
Framework/Library Sizes (with GZIP compression)
36
Source: http://minime.stephan-brumme.com
React’s size is react + react-dom & gzipped via http://cnvyr.io/online
Polymer’s size is polymer-element.js bundled, minified & gzipped.
113.7kb 59.0kb 29.2kb30.4kb35.0kb
v3.0.0 v1.7.4 v3.3.1v2.5.17 v3.0.5v16.5.2
19.8kb
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
Break
Codelab: Build Google Maps using Web Components & No Code!
38
Back early? Try these BONUS challenges!
1. Select “DRIVING” by default
- Hint: check out the Properties listed at
www.webcomponents.org/element/PolymerElements/
paper-tabs/elements/paper-tabs#properties
2. Improve the styles for the search box
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
Codelab Part 2:
Build a Toast
Web Components & With Code!
tinyurl.com/comcast-toast
Let’s code!
Takeaways!
© Comcast
Source: https://github.com/Comcast/polaris
<script href="https://polaris.xfinity.com/polaris.js"></script>
<xc-header
tab="myaccount"
is-authed="[[isAuthed]]"
login-url="/login"
sign-out-url="/logout"
first-name="[[openidData.given_name]]"
user-name="[[openidData.preferred_username]]">
</xc-header>
<xc-footer></xc-footer>
Introduction to Web Components & Polymer Workshop - JS Interactive
45 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop
Angular ElementsVueJS Elements
Framework Components as Custom Elements
46 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop
Other Frameworks for building Web Components
Skate JS
X-Tag
< >XX-Tag
Source: https://elix.org/
“Assemblers First, Craftspeople
Second”
- Ben Issa, 2016 Polymer Summit
Intro to Web Components & Polymer
48
"Puzzle Pieces Jigsaw Piece Concept" is licensed under CC0 1.0 / Color adjusted from original
"Blacksmith Forging Smith Forger" is licensed under CC0 1.0 / Color adjusted from original
Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop
Useful Links
• WebComponents.org - webcomponents.org
• Polymer Website - polymer-project.org
• Polymer Slack - polymer-slack.herokuapp.com
• Polymer 2.x Cheat Sheet - https://meowni.ca/posts/polymer-2-cheatsheet/
• How to use Polymer with Webpack - http://robdodson.me/how-to-use-polymer-with-webpack/
• PWAs with Polymer: a checklist - https://meowni.ca/posts/polymer-pwa-checklist/
• Custom Elements Everywhere - https://custom-elements-everywhere.com/
• Polycasts on YouTube -
https://www.youtube.com/playlist?list=PLOU2XLYxmsII5c3Mgw6fNYCzaWrsM3sMN
• 2018 Google I/O Polymer videos - https://www.polymer-project.org/blog/2018-05-09-polymer-at-io-2018
• 2017 Polymer Summit videos on YouTube -
https://www.youtube.com/playlist?list=PLNYkxOF6rcIDP0PqVaJxqNWwIgvoEPzJi
• End-to-End Polymer Apps - 2017 Chrome Dev Summit video - https://youtu.be/Wu2GCRkDecI
• 2017 Google I/O Polymer videos on YouTube -
https://www.youtube.com/playlist?list=PL_c6rbXV248du6m1VJABo32mP7sXWVb4m
49 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
Thank you!
John Riviello
@JohnRiv
Chris Lorenzo
@Chiefcll

More Related Content

PPTX
Introduction to Web Components & Polymer Workshop - U of I WebCon
John Riviello
 
PDF
Workshop: Introduction to Web Components & Polymer
John Riviello
 
PDF
HTML5 for PHP Developers - IPC
Mayflower GmbH
 
PPTX
The Truth About Your Web App's Performance
John Riviello
 
PPTX
Web Components: The Future of Web Development is Here
John Riviello
 
PDF
Stencil the time for vanilla web components has arrived
Gil Fink
 
PDF
EuroPython 2011 - How to build complex web applications having fun?
Andrew Mleczko
 
PDF
Usability in the GeoWeb
Dave Bouwman
 
Introduction to Web Components & Polymer Workshop - U of I WebCon
John Riviello
 
Workshop: Introduction to Web Components & Polymer
John Riviello
 
HTML5 for PHP Developers - IPC
Mayflower GmbH
 
The Truth About Your Web App's Performance
John Riviello
 
Web Components: The Future of Web Development is Here
John Riviello
 
Stencil the time for vanilla web components has arrived
Gil Fink
 
EuroPython 2011 - How to build complex web applications having fun?
Andrew Mleczko
 
Usability in the GeoWeb
Dave Bouwman
 

What's hot (20)

PDF
How NOT to build a pipeline
Josh Hill
 
PDF
Web components - The Future is Here
Gil Fink
 
PDF
One language to rule them all type script
Gil Fink
 
PDF
Web Components at Scale, HTML5DevConf 2014-10-21
Chris Danford
 
PDF
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
GlobalLogic Ukraine
 
PPTX
Untangling spring week1
Derek Jacoby
 
KEY
HTML5: A brave new world of markup
Chris Mills
 
PPT
Web II - 01 - Introduction to server-side development
Randy Connolly
 
PDF
Practical PHP Deployment with Jenkins
Adam Culp
 
PDF
FuelPHP - a PHP HMVC Framework by silicongulf.com
Christopher Cubos
 
PPTX
Untangling4
Derek Jacoby
 
PDF
Introduction to AngularJS
Jumping Bean
 
KEY
HTML5: what's new?
Chris Mills
 
PPTX
FuelPHP
Nitin Reddy Katkam
 
PDF
FuelPHP presentation - PeoplePerHour workshop
Fotis Alexandrou
 
PDF
Why Your Site is Slow: Performance Answers for Your Clients
Pantheon
 
PDF
Web components: A simpler and faster react
Chris Lorenzo
 
PDF
Write Once, Run Everywhere
Mike North
 
PDF
Should you use HTML5 to build your product? The pros & cons of using current ...
boxuno
 
PPTX
Untangling the web11
Derek Jacoby
 
How NOT to build a pipeline
Josh Hill
 
Web components - The Future is Here
Gil Fink
 
One language to rule them all type script
Gil Fink
 
Web Components at Scale, HTML5DevConf 2014-10-21
Chris Danford
 
GlobalLogic Test Automation Online TechTalk “Playwright — A New Hope”
GlobalLogic Ukraine
 
Untangling spring week1
Derek Jacoby
 
HTML5: A brave new world of markup
Chris Mills
 
Web II - 01 - Introduction to server-side development
Randy Connolly
 
Practical PHP Deployment with Jenkins
Adam Culp
 
FuelPHP - a PHP HMVC Framework by silicongulf.com
Christopher Cubos
 
Untangling4
Derek Jacoby
 
Introduction to AngularJS
Jumping Bean
 
HTML5: what's new?
Chris Mills
 
FuelPHP presentation - PeoplePerHour workshop
Fotis Alexandrou
 
Why Your Site is Slow: Performance Answers for Your Clients
Pantheon
 
Web components: A simpler and faster react
Chris Lorenzo
 
Write Once, Run Everywhere
Mike North
 
Should you use HTML5 to build your product? The pros & cons of using current ...
boxuno
 
Untangling the web11
Derek Jacoby
 
Ad

Similar to Introduction to Web Components & Polymer Workshop - JS Interactive (20)

PPTX
Web Components: The Future of Web Development is Here
John Riviello
 
PDF
Polymer 101
Alea Soluciones, S.L.
 
PDF
Custom Elements with Polymer Web Components #econfpsu16
John Riviello
 
PDF
Web components are the future of the web - Take advantage of new web technolo...
Marios Fakiolas
 
PDF
Tech talk polymer
Yanuar W
 
PPTX
Web Components
FITC
 
PDF
Levent-Gurses' Introduction to Web Components & Polymer
Erik Isaksen
 
PDF
Polymer Polytechnic George Town 2014
Vin Lim
 
PPTX
Web Components
FITC
 
PDF
Polytechnic 1.0 Granada
Israel Blancas
 
PDF
Intro to Web Components, Polymer & Vaadin Elements
Manuel Carrasco Moñino
 
PPT
Intro to polymer-Devfest Yaoundé 2013
gdgyaounde
 
PDF
2014 03-25 - GDG Nantes - Web Components avec Polymer
Horacio Gonzalez
 
PDF
Real World Web components
Jarrod Overson
 
PDF
Web Components with Polymer (extra Polymer 2.0)
Dhyego Fernando
 
PDF
Polymer Web Framework - Swecha Boot Camp
Swecha | స్వేచ్ఛ
 
PDF
Devoxx France - Web Components, Polymer et Material Design
Horacio Gonzalez
 
ODP
Polymer 2.0 introduction at GDG Algiers: Google Fair event
Sylia Baraka
 
PDF
Google Polymer Framework
Kostas Karolemeas
 
PPTX
User-Customizable Web Components for Building One-Page Sites
Pasquale Lisena
 
Web Components: The Future of Web Development is Here
John Riviello
 
Custom Elements with Polymer Web Components #econfpsu16
John Riviello
 
Web components are the future of the web - Take advantage of new web technolo...
Marios Fakiolas
 
Tech talk polymer
Yanuar W
 
Web Components
FITC
 
Levent-Gurses' Introduction to Web Components & Polymer
Erik Isaksen
 
Polymer Polytechnic George Town 2014
Vin Lim
 
Web Components
FITC
 
Polytechnic 1.0 Granada
Israel Blancas
 
Intro to Web Components, Polymer & Vaadin Elements
Manuel Carrasco Moñino
 
Intro to polymer-Devfest Yaoundé 2013
gdgyaounde
 
2014 03-25 - GDG Nantes - Web Components avec Polymer
Horacio Gonzalez
 
Real World Web components
Jarrod Overson
 
Web Components with Polymer (extra Polymer 2.0)
Dhyego Fernando
 
Polymer Web Framework - Swecha Boot Camp
Swecha | స్వేచ్ఛ
 
Devoxx France - Web Components, Polymer et Material Design
Horacio Gonzalez
 
Polymer 2.0 introduction at GDG Algiers: Google Fair event
Sylia Baraka
 
Google Polymer Framework
Kostas Karolemeas
 
User-Customizable Web Components for Building One-Page Sites
Pasquale Lisena
 
Ad

More from John Riviello (7)

PDF
The Decision Buy-In Algorithm - RVAJS 2025
John Riviello
 
PDF
The Decision Buy-In Algorithm
John Riviello
 
PDF
Future-Proofing Your JavaScript Framework Decision
John Riviello
 
PDF
The Critical Career Path Conversation
John Riviello
 
PPTX
Ensuring Design Standards with Web Components
John Riviello
 
PPTX
Polymer-Powered Design Systems - DevFest Florida
John Riviello
 
PPTX
The Truth About Your Web App's Performance
John Riviello
 
The Decision Buy-In Algorithm - RVAJS 2025
John Riviello
 
The Decision Buy-In Algorithm
John Riviello
 
Future-Proofing Your JavaScript Framework Decision
John Riviello
 
The Critical Career Path Conversation
John Riviello
 
Ensuring Design Standards with Web Components
John Riviello
 
Polymer-Powered Design Systems - DevFest Florida
John Riviello
 
The Truth About Your Web App's Performance
John Riviello
 

Recently uploaded (20)

PDF
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
PDF
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
agentic-ai-and-the-future-of-autonomous-systems.pdf
siddharthnetsavvies
 
PPTX
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
PDF
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
The Power of IoT Sensor Integration in Smart Infrastructure and Automation.pptx
Rejig Digital
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
AbdullahSani29
 
PPTX
C Programming Basics concept krnppt.pptx
Karan Prajapat
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
Google’s NotebookLM Unveils Video Overviews
SOFTTECHHUB
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
BLW VOCATIONAL TRAINING SUMMER INTERNSHIP REPORT
codernjn73
 
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
agentic-ai-and-the-future-of-autonomous-systems.pdf
siddharthnetsavvies
 
Comunidade Salesforce São Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira Júnior
 
Make GenAI investments go further with the Dell AI Factory - Infographic
Principled Technologies
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
The Power of IoT Sensor Integration in Smart Infrastructure and Automation.pptx
Rejig Digital
 
Software Development Company | KodekX
KodekX
 
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
AbdullahSani29
 
C Programming Basics concept krnppt.pptx
Karan Prajapat
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 

Introduction to Web Components & Polymer Workshop - JS Interactive

  • 1. Workshop: Introduction to Web Components & Polymer Node+JS Interactive Wednesday, October 10, 2018 • 11:00am - 12:50pm John Riviello @JohnRiv Chris Lorenzo @Chiefcll
  • 2. Workshop materials are available at: http://tinyurl.com/ nodejsint-polymer -workshop
  • 4. What Are Web Components? Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop4 … a set of web platform APIs that allow you to create new custom, reusable, encapsulated HTML tags to use in web pages and web apps... Source: https://www.webcomponents.org/introduction
  • 5. What Are Web Components? 5 … [built] on the Web Component standards, will work across modern browsers, and can be used with any JavaScript library or framework that works with HTML. Source: https://www.webcomponents.org/introduction Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 6. What Are Web Components? 6 4 Specs Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 7. What Are Web Components? 7 Custom Elements Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 8. What Are Web Components? 8 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 9. What Are Web Components? 9 Custom Elements •Provides a way for authors to build their own fully-featured DOM elements. <paper-tabs selected="0" scrollable> <paper-tab>The first tab</paper-tab> <paper-tab>Tab two</paper-tab> <paper-tab>The third tab</paper-tab> <paper-tab>Fourth tab</paper-tab> </paper-tabs> Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 10. What Are Web Components? 10 HTML Imports Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 11. What Are Web Components? 11 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 12. • Means to import custom elements - <link rel="import" href="paper-tabs.html"> • Componetize the HTML, CSS & JavaScript • Built-in deduplication What Are Web Components? 12 HTML Imports Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 13. What Are Web Components? 13 Templates Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 14. What Are Web Components? 14 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 15. What Are Web Components? 15 • 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 quickly render the content Templates Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 16. What Are Web Components? 16 Shadow DOM Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 17. What Are Web Components? 17 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 18. What Are Web Components? 18 •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"> Shadow DOM Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 19. Can we even use these things?
  • 20. 20 Source: https://www.webcomponents.org/ Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 21. 21 Source: https://www.webcomponents.org/ Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 22. 22 Source: https://www.webcomponents.org/ Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 23. 23 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 24. 24 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 25. 25 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 33. Codelab: Build Google Maps using Web Components & No Code! tinyurl.com/comcast-polymer-map
  • 34. Codelab: Build Google Maps using Web Components & No Code! 34 Codelab URL: tinyurl.com/comcast-polymer-map Relevant Map Data: •latitude="49.2892" •longitude="-123.1169" •start-address="1055 Canada Place" •end-address="TELUS Garden" Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 36. Intro to Web Components & Polymer Framework/Library Sizes (with GZIP compression) 36 Source: http://minime.stephan-brumme.com React’s size is react + react-dom & gzipped via http://cnvyr.io/online Polymer’s size is polymer-element.js bundled, minified & gzipped. 113.7kb 59.0kb 29.2kb30.4kb35.0kb v3.0.0 v1.7.4 v3.3.1v2.5.17 v3.0.5v16.5.2 19.8kb Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 37. Break
  • 38. Codelab: Build Google Maps using Web Components & No Code! 38 Back early? Try these BONUS challenges! 1. Select “DRIVING” by default - Hint: check out the Properties listed at www.webcomponents.org/element/PolymerElements/ paper-tabs/elements/paper-tabs#properties 2. Improve the styles for the search box Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop
  • 39. Codelab Part 2: Build a Toast Web Components & With Code! tinyurl.com/comcast-toast
  • 45. 45 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop Angular ElementsVueJS Elements Framework Components as Custom Elements
  • 46. 46 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop Other Frameworks for building Web Components Skate JS X-Tag < >XX-Tag
  • 48. “Assemblers First, Craftspeople Second” - Ben Issa, 2016 Polymer Summit Intro to Web Components & Polymer 48 "Puzzle Pieces Jigsaw Piece Concept" is licensed under CC0 1.0 / Color adjusted from original "Blacksmith Forging Smith Forger" is licensed under CC0 1.0 / Color adjusted from original Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/comcast-polymer-workshop
  • 49. Useful Links • WebComponents.org - webcomponents.org • Polymer Website - polymer-project.org • Polymer Slack - polymer-slack.herokuapp.com • Polymer 2.x Cheat Sheet - https://meowni.ca/posts/polymer-2-cheatsheet/ • How to use Polymer with Webpack - http://robdodson.me/how-to-use-polymer-with-webpack/ • PWAs with Polymer: a checklist - https://meowni.ca/posts/polymer-pwa-checklist/ • Custom Elements Everywhere - https://custom-elements-everywhere.com/ • Polycasts on YouTube - https://www.youtube.com/playlist?list=PLOU2XLYxmsII5c3Mgw6fNYCzaWrsM3sMN • 2018 Google I/O Polymer videos - https://www.polymer-project.org/blog/2018-05-09-polymer-at-io-2018 • 2017 Polymer Summit videos on YouTube - https://www.youtube.com/playlist?list=PLNYkxOF6rcIDP0PqVaJxqNWwIgvoEPzJi • End-to-End Polymer Apps - 2017 Chrome Dev Summit video - https://youtu.be/Wu2GCRkDecI • 2017 Google I/O Polymer videos on YouTube - https://www.youtube.com/playlist?list=PL_c6rbXV248du6m1VJABo32mP7sXWVb4m 49 Workshop: Introduction to Web Components & Polymer - @JohnRiv @chiefcll - tinyurl.com/nodejsint-polymer-workshop