Skip to content

A minimal generator for LitElement Web Components –– npm init kcmr/lit-component

Notifications You must be signed in to change notification settings

kcmr/create-lit-component

Repository files navigation

LitElement Web Component generator

oclif Parcel

A minimal scaffold generator for Web Components with LitElement.

$ npm init kcmr/lit-component

CLI Screenshot

Features:

  • Uses Parcel bundler for the component's demo (dev server). Super fast build and reload!
  • @open-wc/testing for unit tests (TDD style)
  • Allows to import the component class without element registration. Define the tag as you like

Usage

Install it globally and run it:

$ npm i -g kcmr/lit-component
$ lit-component

Or run it directly without installation (get always the latest version from github):

$ npm init kcmr/lit-component

Options

Component:

  • -n, --name Component name
  • -d, --description Component description (used in description field inside package.json)
  • -s, --scope Optional package scope (@my-company)
  • -i, --[no-]install Install dependencies (true). Use --no-install to skip dependency installation
  • --silent Use silent dependency installation

CLI:

  • -h, --help Shows the CLI help
  • -v, --version Shows the CLI version

Config files or key in package.json

The CLI will remember the choices of the last execution with your preferences about the package scope but you can also use configuration files or a specific property in a package.json file.

  • lit-component property in a package.json
  • .lit-componentrc (JSON or YAML format)
  • .lit-componentrc.json
  • .lit-componentrc.yaml, .lit-componentrc.yml
  • .lit-componentrc.js
  • lit-component.config.js

Example config:

{
  "scope": "@my-company",
  "description": "An awesome component",
  "install": false
}