What are Web Components?
Web components are nothing but reusable components were each of the components contains some custom elements, HTML imports, and a template. If you are familiar in using React, Angular, etc. then you are already using web components. Components in React are really web components. Similarly, Angular directives can be considered as a web component.
The Benefits of Using Polymer
It provides both two way and one-way data binding.
The projects can be managed by the CLI provided by polymer and they are very useful in creating complicated word Applications by using query very friendly and simple elements.
The main components of Polymer CLI are a boilerplate generator, build pipeline, a test runner, a linter and a development center.
The Main Features of Polymer
Polymer.js correspondent corporate standards for creating reusable widgets if the required Word documents as well as the web applications.
It also provides polyfill which enables implementing a feature on the web browsers that do not support it.
It uses Google material design for developing a mobile application which is hybrid in nature. The HTML import and the custom element present in can be used fiber uses and the custom elements are distributed across the entire network.
So we can learn the steps in installing Polymer.js on Windows 10.
1. Install Chocolatey
Chocolatey is a popular package manager for Windows. We can install all the packages and dependencies required to install Polymer.js using Chocolatey. So at first, we need to install it on our system.
To install Chocolaty, Open Command Prompt with administrator privileges and run the command below.
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
2. Install Nodejs
In this tutorial, we are going to install Polymer CLI using the Node Package Manager(NPM). So first, it needs to install Nodejs on our system. NPM will be installed with Nodejs itself.
The LTS version of Nodejs can be installed on our system using the below Chocolatey command.
choco install -y nodejs-lts
Note:- Alternatively we can download and install Nodejs from the official website. If so, it does not need Chocolatey to be installed on our system.
3. Install Git
It requires to install Git on our system because, on step 5, we need to clone the starting code for our first polymer project from Github. The below command will take care of installing Git.
choco install git.install
Note:- Alternatively we can download and install Git from the official download page for git. If so, it does not need Chocolatey to be installed on our system.
4. Install Polymer CLI
Polymer CLI helps us to create projects, generate application and library code, and perform a variety of ongoing development tasks such as testing, bundling, and deployment.
It can simply be installed using NPM.
npm install -g polymer-cli
5. Clone the Starting Code
Now we need to download a starting code from Github to create our first application using Polymer. We can easily clone this project using git.
git clone https://github.com/PolymerLabs/polymer-3-first-element.git
6. Install Dependencies for the Starting Code
So we have cloned the starting project from Github and we need to install the dependencies required for it. It can be done with NPM.
cd polymer-3-first-element npm install
7. Running the app
Now, the app we have cloned can be run from our system.
polymer serve --open
This will open up a new browser tab on our system with the below URL.
It is our Polymer project and we customize it in our ways.