On this page:

Install pre-requisites

To work locally with lit-element, you'll first need to install Git, npm and Node.js, and the Polymer CLI.

  1. Install Git.

  2. Install npm and Node.js.

  3. Update npm:

    bash npm install -g npm@latest

  4. Install Polymer CLI:

    bash npm install -g polymer-cli@latest

Create a new LitElement project

mkdir myproject
cd myproject
npm init -y
npm install --save @polymer/lit-element
npm install --save @webcomponents/webcomponentsjs


Create a polymer.json config file, and serve your project:

cd myproject
npm install
echo '{
  "npm": true,
  "moduleResolution": "node",
  "entrypoint": "src/index.html",
  "shell": "src/my-project.js",
  "extraDependencies": [
  "builds": [{
    "name": "mybuild",
    "bundle": true,
    "js": {
      "minify": true
}' >polymer.json
polymer serve

See the docs for more information on working with Polymer CLI.


Build your project, and serve the build locally:

cd myproject
polymer build
polymer serve build/mybuild

For more information on building LitElement projects see Build for production.