Confession

Before we get started, I have to confess that I am new to Polymer, never used previous versions, so this series is as much for me as I progress on my own journey with Polymer, and hopefully it can be useful as a different perspective some others.

The other imporant note, is that this is a tutorial for Linux users. I’m not sure where the differences lie between the setup and use for Winodws/Mac, so I won’t cover them.

What is Polymer?

Polymer is a way of building web applications using reusable components.

Installation and Setup

One of the big differences between Polymer 2.0 and 3.0 is the use of npm over bower - so we will be using npm a lot, so make sure you have NodeJS installed.

To get started, we need to install the polymer command line interface with:

npm install -g polymer-cli

Now, at first I tried to use the polymer-3-starter-kit, but hit problems right from the beginning. I had much more luck cloning this repository.

git clone https://github.com/PolymerLabs/start-polymer3.git

cd start-polymer3

Moves into the new directory.

npm install

Installs all dependencies required.

polymer serve

Serve onto localhost.

Using Components

Install your component from npm.

npm install @polymer/web-component

This adds the component to your node_modules/ directory. Then in the file you wish to use this component, import it using:

import "@polyerm/web-component/web-component.js";