Get the code
Table of contents
Installing Polymer
If you’re ready to start your own project, you can install Polymer in one of several ways:
-
Bower. Recommended. Bower manages dependencies, so installing a component also installs any missing dependencies. Bower also handles updating installed components. For more information, see Installing with Bower.
-
ZIP file. Includes all dependencies, so you can unzip it and start using it immediately. The ZIP file requires no extra tools, but doesn’t provide a built-in method for updating dependencies. For more information, see Installing from ZIP files.
-
GitHub. When you clone a component from GitHub, you need to manage all of the dependencies yourself. If you’d like to hack on the project or submit a pull request, see setting up Polymer with git.
When you install Polymer using Bower or the ZIP file, you get the Web Components polyfill library. Using the polyfills ensures that you can use Polymer with browsers that don’t support the Web Components specifications natively.
Note: For information about installing elements from the Core and Paper element collection, see Using elements.
Installing with Bower
The recommended way to install Polymer 0.5.6 is through Bower. To install Bower, see the Bower web site.
Bower removes the hassle of dependency management when developing or consuming elements. When you install a component, Bower makes sure any dependencies are installed as well.
Project setup
If you haven’t created a bower.json
file for your application, run this
command from the root of your project:
bower init
This generates a basic bower.json
file. Some of the questions, like
“What kind of modules do you expose,” can be ignored by pressing Enter.
The next step is to install Polymer:
bower install --save Polymer/polymer#^0.5
Bower adds a bower_components/
folder in the root of your project and
fills it with Polymer and its dependencies.
Tip: --save
adds the item as a dependency in your app’s bower.json:
{
"name": "my-project",
"version": "0.0.0",
"dependencies": {
"polymer": "Polymer/polymer#^0.5"
}
}
Updating packages
When a new version of Polymer is available, run bower update
in your app directory to update your copy:
bower update
This updates all packages in bower_components/
.
Installing from ZIP files
To download Polymer as a ZIP file, click the GET POLYMER button then click Download ZIP.
When you download Polymer as a ZIP file, you get all of the dependencies bundled into a single archive. It’s a great way to get started because you don’t need to install any additional tools.
Expand the ZIP file in your project directory to create a bower_components
folder.
Unlike Bower, the ZIP file doesn’t provide a built-in method for updating dependencies. You can manually update components with a new ZIP file.
Note: If you decide to install Bower later, you can use Bower to update the components you installed from the ZIP file. Follow the instructions in Updating packages.
Using git
Because there are a number of dependencies we suggest you install Polymer with Bower instead of git. If you’d like to hack on the project or submit a pull request check out our guide on setting up Polymer with git.
Next steps
Now that you’ve installed Polymer it’s time to learn the core concepts. In the next section we’ll get you up and running on creating elements using Polymer. Continue on to:
If you’d rather skip ahead, check out the tutorial, or skip to the API developer guide.