Get a quick introduction to some of the commands provided by the Polymer CLI.
- In this chapter we're going to see how to use Polymer elements in existing web applications. This is probably one of the more common ways to use Polymer. Before we do that however, we're going to take a quick look at the Polymer command line tool. The Polymer command line tool or CLI as it's called provides a set of commands that simplifies some of the more common operations that you will typically have to perform during development so open the terminal window on your system and then run the command polymer help.
Now if you set up your development environment as we did earlier and installed the Polymer tools correctly then you'll see a screen that looks like this with a listing of the available commands. Now since this is an introductory course, we're not going to go through all of these commands. I want to highlight just a few of them, the init, install, and serve commands. So the init command is used to initialize Polymer projects, specifically there are two kinds of projects, elements and applications.
We will see more of this command when we get to the chapter on scaffolding Polymer projects. The Ploymer install command is used to install component dependencies for the project. It's essentially the same as running the Bower install command and Polymer serve is used to run the development server that comes with Polymer. You can use this server during development to test your components and applications. It's not required that you use it and if you already have a testing server, you might want to use that one instead but I personally find the development server to be useful when I'm prototyping or just trying things out so if you want to get more information about any of these commands you just need to type polymer help and then the name of the command so in this case I'll type serve and I'll hit enter and you can see all of the options that are available for this command so we'll see how to use some of the other commands later in the course.
The rest of this chapter will focus on using components in an app along with the webcomponents.org site where you can find hundreds of third party components ready for you to use.
- What is Polymer?
- The Polymer command line
- Using components in an app
- The web components catalog
- Building a web component
- Defining component structure and appearance
- Scaffolding a Polymer project
- Creating an element
- Polymer data binding