SlideShare a Scribd company logo
1 of 56
Download to read offline
@granze
Polymer is production ready.
How about you? Maurizio Mangione
ROME 18-19 MARCH 2016
@granze
@Granze
Google Developers Expert
Milano JS Founder
@granze
What is this talk about?
@granze
I ♥ Polymer
@granze
Web Components
@granze
Custom Elements
<my-component></my-component>
<x-element attribute="test"></x-element>
@granze
HTML Imports
<link rel="import" href="path/to/component.html">
@granze
Templates
<template id="template">
<div>
<h1>Web Components</h1>
<img src="http://webcomponents.org/img/logo.svg">
</div>
</template>
@granze
Shadow DOM
var progressBar = document.createElement('div');
var shadowRoot = progressBar.attachShadow({mode:
'closed'});
var template = document.getElementById('template');
shadowRoot.appendChild(template).content.cloneNode
(true));
V1
@granze
webcomponents-lite.js
@granze
Standards
@granze
“Always bet on Javascript”
Brendan Eich
@granze
“Always bet on
the Web Platform”
Me
@granze
@granze
Let’s build an App
@granze
1 Create reusable elements
● Start with the seed-element
● Use Polyserve
● Publish via Bower
@granze
<seed-element>
● Element boilerplate
● Test ready
● Auto generated docs
@granze
@granze
Visual and non-visual elements
@granze
2 Put things together
@granze
How elements talk to each other
API API
<child-component><child-component>
@granze
<g-tag my-attr="true">
Polymer({
is: 'g-tag',
properties: {
myAttr: {
type: Boolean
}
}
});
@granze
Mediator Pattern
API API
BUSINESS LOGIC
wrapper
<child-component><child-component>
@granze
The wrapper
@granze
<x-app>
<link rel="import" href="polymer/polymer.html">
<dom-module id="x-app">
<template>
<!-- add elements here -->
</template>
<script>
Polymer({ is: 'x-app' });
</script>
</dom-module>
@granze
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="import" href="x-app/x-app.html">
</head>
<body>
<x-app></x-app>
</body>
</html>
@granze
<template is="dom-bind">
<body>
<template id="app" is="dom-bind">
<a href="#" on-click="sayHello">Click me!</a>
</template>
<script>
const app = document.querySelector('#app');
app.sayHello = () => { console.log('Hello') };
</script>
</body>
@granze
Should I use Mediator Pattern?
@granze
Use what you like the most
● Events (fire, listen)
● Flux-like architecture
● Your own solution
@granze
3 Testing
@granze
Web component tester
> npm i -g web-component-tester
> wct
@granze
Web component tester
@granze
4 The build step
@granze
Tools of the trade
● Vulcanize
● Crisper
● NPM scripts or Gulp
@granze
Vulcanize
> vulcanize target.html > build.html
@granze
Crisper
> cat index.html | crisper -h build.html -j build.js
@granze
So, what I need?
● Elements
● Let them talk to each other
● Test all the things
● Build/deploy
@granze
Polymer Starter Kit
@granze
PSK’s Hot features
● Offline support
● Complete build chain
● Responsive app layout
@granze
Yeoman
> npm i -g yo
> npm install -g generator-polymer
> yo polymer
@granze
Ok sold, but is not so easy...
@granze
@granze
You can win!
One component at a time
@granzeCredits: http://nocamels.com/2014/06/israeli-researchers-create-trojan-horse-of-chemotherapy
@granze
I don’t want to add more stuff
to my legacy app
@granze
Think about jQuery plugins
@granze
Useful resources
@granze
Community
http://polymer-slack.herokuapp.com
@granze
Polycasts
@granze
@granze
Awesome Polymer
@granze
Should you build your app
entirely with Web Components?
@granze
Is up to you!
@granze
Polymer is good because
● Built on standards
● Freedom of choice
● Production ready...
@granze
...how about you?
@granze
Thanks

More Related Content

What's hot

Polymer - Una bella historia de amor
Polymer - Una bella historia de amorPolymer - Una bella historia de amor
Polymer - Una bella historia de amorIsrael Blancas
 
WooCommerce: Customization FAQ
WooCommerce: Customization FAQWooCommerce: Customization FAQ
WooCommerce: Customization FAQRodolfo Melogli
 
GoCoding.Today For Rails - Episode1
GoCoding.Today For Rails - Episode1GoCoding.Today For Rails - Episode1
GoCoding.Today For Rails - Episode1Brian Hu
 
Thinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSThinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSTJ Stalcup
 
Polymer - El fin a tus problemas con el FrontEnd
Polymer - El fin a tus problemas con el FrontEndPolymer - El fin a tus problemas con el FrontEnd
Polymer - El fin a tus problemas con el FrontEndIsrael Blancas
 
Introduction to Django CMS
Introduction to Django CMS Introduction to Django CMS
Introduction to Django CMS Pim Van Heuven
 
Thinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSThinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSTJ Stalcup
 
Web Development with Vim by Johannes Raggam
Web Development with Vim by Johannes RaggamWeb Development with Vim by Johannes Raggam
Web Development with Vim by Johannes RaggamT. Kim Nguyen
 
Kentico Cloud Best Practices
Kentico Cloud Best PracticesKentico Cloud Best Practices
Kentico Cloud Best PracticesKentico Software
 
Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014Nguyễn Thành Hải
 
From website to mobile app - a journey
From website to mobile app - a journeyFrom website to mobile app - a journey
From website to mobile app - a journeyMartin Naumann
 
Word press plugin development
Word press plugin development Word press plugin development
Word press plugin development Md Shahjahan Jewel
 
Magento 2 Community Project - Moving from LESS to SASS
Magento 2 Community Project - Moving from LESS to SASSMagento 2 Community Project - Moving from LESS to SASS
Magento 2 Community Project - Moving from LESS to SASSBartek Igielski
 
Thinkful DC FrontEnd Crash Course - HTML & CSS
Thinkful DC FrontEnd Crash Course - HTML & CSSThinkful DC FrontEnd Crash Course - HTML & CSS
Thinkful DC FrontEnd Crash Course - HTML & CSSTJ Stalcup
 

What's hot (20)

Yeoman intro
Yeoman introYeoman intro
Yeoman intro
 
Polymer - Una bella historia de amor
Polymer - Una bella historia de amorPolymer - Una bella historia de amor
Polymer - Una bella historia de amor
 
WooCommerce: Customization FAQ
WooCommerce: Customization FAQWooCommerce: Customization FAQ
WooCommerce: Customization FAQ
 
Blogging for hackers (english)
Blogging for hackers (english)Blogging for hackers (english)
Blogging for hackers (english)
 
De 0 a Polymer
De 0 a PolymerDe 0 a Polymer
De 0 a Polymer
 
GoCoding.Today For Rails - Episode1
GoCoding.Today For Rails - Episode1GoCoding.Today For Rails - Episode1
GoCoding.Today For Rails - Episode1
 
Thinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSThinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSS
 
Polymer - El fin a tus problemas con el FrontEnd
Polymer - El fin a tus problemas con el FrontEndPolymer - El fin a tus problemas con el FrontEnd
Polymer - El fin a tus problemas con el FrontEnd
 
Introduction to Django CMS
Introduction to Django CMS Introduction to Django CMS
Introduction to Django CMS
 
Thinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSSThinkful FrontEnd Crash Course - HTML & CSS
Thinkful FrontEnd Crash Course - HTML & CSS
 
DevDay 2018 - Blazor
DevDay 2018 - BlazorDevDay 2018 - Blazor
DevDay 2018 - Blazor
 
Web Development with Vim by Johannes Raggam
Web Development with Vim by Johannes RaggamWeb Development with Vim by Johannes Raggam
Web Development with Vim by Johannes Raggam
 
Kentico Cloud Best Practices
Kentico Cloud Best PracticesKentico Cloud Best Practices
Kentico Cloud Best Practices
 
Frontend Crash Course
Frontend Crash CourseFrontend Crash Course
Frontend Crash Course
 
Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014Wade.Go Introduction Speech - SFD HCMC 2014
Wade.Go Introduction Speech - SFD HCMC 2014
 
JSConf.eu Overview
JSConf.eu OverviewJSConf.eu Overview
JSConf.eu Overview
 
From website to mobile app - a journey
From website to mobile app - a journeyFrom website to mobile app - a journey
From website to mobile app - a journey
 
Word press plugin development
Word press plugin development Word press plugin development
Word press plugin development
 
Magento 2 Community Project - Moving from LESS to SASS
Magento 2 Community Project - Moving from LESS to SASSMagento 2 Community Project - Moving from LESS to SASS
Magento 2 Community Project - Moving from LESS to SASS
 
Thinkful DC FrontEnd Crash Course - HTML & CSS
Thinkful DC FrontEnd Crash Course - HTML & CSSThinkful DC FrontEnd Crash Course - HTML & CSS
Thinkful DC FrontEnd Crash Course - HTML & CSS
 

Similar to Codemotion Rome 2016 - Polymer

ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...Horacio Gonzalez
 
Polymer
Polymer Polymer
Polymer jskvara
 
Challenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceChallenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceGiacomo Zecchini
 
Web Components
Web ComponentsWeb Components
Web ComponentsFITC
 
Intro To Django
Intro To DjangoIntro To Django
Intro To DjangoUdi Bauman
 
Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18Horacio Gonzalez
 
Polymer Code Lab in Dart - DevFest Kraków 2014
Polymer Code Lab in Dart - DevFest Kraków 2014Polymer Code Lab in Dart - DevFest Kraków 2014
Polymer Code Lab in Dart - DevFest Kraków 2014jskvara
 
Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.gjdevos
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...Horacio Gonzalez
 
Process process process
Process process processProcess process process
Process process processmagnificode
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoJuliano Martins
 
Bundling Client Side Assets
Bundling Client Side AssetsBundling Client Side Assets
Bundling Client Side AssetsTimothy Oxley
 
Frontend microservices: architectures and solutions
Frontend microservices: architectures and solutionsFrontend microservices: architectures and solutions
Frontend microservices: architectures and solutionsMikhail Kuznetcov
 
Introduction to the IBM Watson Data Platform
Introduction to the IBM Watson Data PlatformIntroduction to the IBM Watson Data Platform
Introduction to the IBM Watson Data PlatformMargriet Groenendijk
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web componentsHoracio Gonzalez
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftShekhar Gulati
 
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...Shem Magnezi
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationDavid Amend
 
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
 

Similar to Codemotion Rome 2016 - Polymer (20)

ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
ENIB 2015-2016 - CAI Web - S01E01- Côté navigateur 3/3 - Web components avec ...
 
Polymer
Polymer Polymer
Polymer
 
Challenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering serviceChallenges of building a search engine like web rendering service
Challenges of building a search engine like web rendering service
 
Web Components
Web ComponentsWeb Components
Web Components
 
Intro To Django
Intro To DjangoIntro To Django
Intro To Django
 
Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18Beyond Polymer - JUG Summer Camp - 2015-09-18
Beyond Polymer - JUG Summer Camp - 2015-09-18
 
Polymer Code Lab in Dart - DevFest Kraków 2014
Polymer Code Lab in Dart - DevFest Kraków 2014Polymer Code Lab in Dart - DevFest Kraków 2014
Polymer Code Lab in Dart - DevFest Kraków 2014
 
Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.Serverless? How (not) to develop, deploy and operate serverless applications.
Serverless? How (not) to develop, deploy and operate serverless applications.
 
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
ENIB 2015 2016 - CAI Web S02E01- Côté Navigateur 3/3 - Web Components avec Po...
 
Process process process
Process process processProcess process process
Process process process
 
wotxr-20190320rzr
wotxr-20190320rzrwotxr-20190320rzr
wotxr-20190320rzr
 
Desenvolvimento Mobile Híbrido
Desenvolvimento Mobile HíbridoDesenvolvimento Mobile Híbrido
Desenvolvimento Mobile Híbrido
 
Bundling Client Side Assets
Bundling Client Side AssetsBundling Client Side Assets
Bundling Client Side Assets
 
Frontend microservices: architectures and solutions
Frontend microservices: architectures and solutionsFrontend microservices: architectures and solutions
Frontend microservices: architectures and solutions
 
Introduction to the IBM Watson Data Platform
Introduction to the IBM Watson Data PlatformIntroduction to the IBM Watson Data Platform
Introduction to the IBM Watson Data Platform
 
BreizhBeans - Web components
BreizhBeans - Web componentsBreizhBeans - Web components
BreizhBeans - Web components
 
Power up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShiftPower up Magnolia CMS with OpenShift
Power up Magnolia CMS with OpenShift
 
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...
“Micro Frontends”- You Keep Using That Word, I Don’t Think It Means What You ...
 
Grunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous IntegrationGrunt.js and Yeoman, Continous Integration
Grunt.js and Yeoman, Continous Integration
 
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
 

Codemotion Rome 2016 - Polymer