Sitemap
Erik Ringsmuth

Erik Ringsmuth

Build Apps with Web Components today!

2 min readAug 10, 2014

--

Web Components are the future building blocks of the web. Polymer adds features like templating, data binding, and event handling. How does this stack up to today’s frameworks?

MVC — Custom Elements, Polymer Elements

Templating / Data Binding — <template>, Polymer Data Binding

Event Handling — CustomEvents, Polymer Event Mapping

Routing — app-router, core-animated-pages, server routing like express.js

Modules / DI — HTML Imports

All of these tools are available natively in the DOM, in libraries like Polymer, or as web components.

Putting it together

Something incredible happens when you combine Custom Elements, HTML Imports, and a package manager like Bower. You are no longer tied to a single framework!

Custom Element APIs are vanilla HTML. A developer using a 3rd party element should be blissfully unaware if it was created with Polymer, natively, or with any other dependencies.

Get Erik Ringsmuth’s stories in your inbox

Join Medium for free to get updates from this writer.

For example, a chuck-norris-joke element might look like this.

<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../core-ajax/core-ajax.html">
<polymer-element name="chuck-norris-joke" noscript>
<template>
<core-ajax url="http://api.icndb.com/jokes/random"
auto handleAs="json" response="{{data}}">
</core-ajax>
{{data.value.joke}}
</template>
</polymer-element>

You would install the element with Bower.

bower install chuck-norris-joke --save

Then use it in your web app.

<link rel="import" href="/bower_components/chuck-norris-joke/chuck-norris-joke.html"><p>Random joke: <chuck-norris-joke></chuck-norris-joke></p>

Behind the scenes Bower installed polymer and core-ajax when you installed chuck-norris-joke. HTML Imports loaded all of the dependencies when you imported chuck-norris-joke.

This is the future!

It no longer matters what library you use to write your components. jQuery plugins, Angular directives, and React components all fade away. DOM is the new framework! Everything is interoperable!

Many of the most common components will start out as Polymer elements and later be re-written without dependencies to be lightweight. New libraries similar to Polymer will show up with features like Virtual DOM and different forms of templating.

But you don’t have to wait. Tons of elements are available today. Check them out at http://customelements.io/.

You can build your own Polymer elements in the browser at https://ele.io/.

Get going! Make an app!

Got questions? Let me know @erikringsmuth.

--

--