Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intro to Web Components

Intro to Web Components

Not so short presentation for the Brighton webdev meetup on web components.

Miguel Laginha

August 29, 2019
Tweet

More Decks by Miguel Laginha

Other Decks in Programming

Transcript

  1. ABOUT ME ▸ Miguel Laginha ▸ Apereo Foundation ▸ Open

    Academic Environment (OAE) ▸ ESUP-Portail
  2. WE CAN ALL BE BFFS AND LEVERAGE EACH OTHER'S WITHOUT

    ADOPTING EVERY ASPECT OT EACH OTHER'S WORK
  3. <your-tag></your-tag> <!-- - Custom, reusable, encapsulated HTML tags - For

    use in web pages and web apps - Work in all major browsers - JS agnostic -->
  4. HELLO WORLD EXAMPLE // taken from https://lit-element.polymer-project.org/ import { LitElement,

    html } from 'lit-element'; class SimpleGreeting extends LitElement { static get properties() { return { name: { type: String } }; } constructor() { super(); this.name = 'World'; } render() { return html`<p>Hello, ${this.name}!</p>`; } } customElements.define('simple-greeting', SimpleGreeting);
  5. WHAT'S IN IT FOR DEVS? ▸ CSS is scoped ▸

    Custom HTML is semantic ▸ JS scoping is simpler ▸ Re-usable code ▸ Accessibility becomes manageable ▸ WC keeps design intentional
  6. WHAT'S IN IT FOR MANAGERS? ▸ Lower maintenance costs ▸

    Cost of development collapses ▸ Lower boilerplate and churn for future projects ▸ Extensibility ▸ It's a W3C standard, no legacy
  7. A GLIMPSE INTO THE FUTURE ▸ video players ▸ dropdown

    menus ▸ timelines ▸ animations ▸ all sorts of visual and non visual components
  8. ADVANTAGES IN A NUTSHELL ▸ 100% re-usable components (style, business

    logic or mixed) ▸ Split work among teams ▸ CDN served components ▸ No need for greenfield projects, upgrade step by step! ▸ No need for a framework ▸ Avoid (platform) lock-in
  9. BARRIERS TO ADOPTION ▸ Lots of libraries already (litElement, skateJs,

    Stencil, slimJS, etc) ▸ Requires proper JS knowledge ▸ Requires tooling (webpack, lerna, rollup, npm, git, etc...) ▸ Deployment ▸ Documentation