0.1.44 ā€¢ Published 5 months ago

create-lit-pwa v0.1.44

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

Create Lit PWA

npm.io

To install, run

npm init lit-pwa@latest

Introduction

This is a simple template for a PWA that uses only native Web Components, with only Google's Lit library to make working with Web Components easier.

  • PWA Installable on desktop, tablet and mobile
  • Works offline
  • Passes all Lighthouse tests
  • TS and JS can be used simultaneously

Why Lit?

Lit handles smart reactive rendering in a way similar to React, but without the overhead of a Virtual DOM.\ It uses native ES String Literals and variables. Hence the name 'lit'.

import {html, css, LitElement} from 'lit';
import {customElement, property} from 'lit/decorators.js';

@customElement('simple-greeting')
export class SimpleGreeting extends LitElement {
  static styles = css`p { color: blue }`;

  @property()
  name = 'Somebody';

  render() {
    return html`<p>Hello, ${this.name}!</p>`;
  }
}

The library adds just 5KB to your bundle.\ šŸ’” Learn Lit:

Dev Tools

  • Uses TypeScript and ESLint for static analysis
  • Uses ESBuild for:
    • TypeScript compilation
    • Bundling
    • Development web server

VS Code Extensions

It is highly recommended to install following extensions:

  • esbenp.prettier-vscode
  • runem.lit-plugin
  • dbaeumer.vscode-eslint

Service worker

Lit PWA uses a service worker to implement the following features:

  • Installability
  • Work offline
  • Runtime caching
  • Serving index.html in case the server is not available or does not implement "spa behavior"

For day-to-day development, Lit PWA uses a 'Dev' service worker, which is "transparent" in the sense that it doesn't have any caching. Using this worker helps achieve a better development experience.

NPM scripts

We included 2 options for starting a development server, based on different development scenarios:

1: Common frontend development

  • 'Hot' browser reloading at every code change
  • 'Transparent' development service worker
npm start

2: Developing offline features, testing caching, running Lighthouse tests

  • Rebuild on change
  • No Live reloading
  • Fully functional service worker
npm run serve

Build for production:

npm run build

Run tests:

npm test

Debug tests:

npm run test:debug

Testing

Lit PWA uses @web/test-runner for testing. You can read more about it here:

https://modern-web.dev/guides/test-runner/getting-started https://modern-web.dev/guides/test-runner/watch-and-debug/ https://www.npmjs.com/package/web-test-runner-jasmine

0.1.41

5 months ago

0.1.42

5 months ago

0.1.43

5 months ago

0.1.44

5 months ago

0.1.40

5 months ago

0.1.38

7 months ago

0.1.39

7 months ago

0.1.30

9 months ago

0.1.31

9 months ago

0.1.32

9 months ago

0.1.33

9 months ago

0.1.34

9 months ago

0.1.35

9 months ago

0.1.36

9 months ago

0.1.37

9 months ago

0.1.27

10 months ago

0.1.28

10 months ago

0.1.29

9 months ago

0.1.26

10 months ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.25

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.0

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.0.52

1 year ago

0.0.53

1 year ago

0.0.54

1 year ago

0.0.41

1 year ago

0.0.42

1 year ago

0.0.43

1 year ago

0.0.44

1 year ago

0.0.45

1 year ago

0.0.46

1 year ago

0.0.47

1 year ago

0.0.51

1 year ago

0.0.50

1 year ago

0.0.48

1 year ago

0.0.49

1 year ago

0.0.4

1 year ago

0.0.39

1 year ago

0.0.38

1 year ago

0.0.37

1 year ago

0.0.36

1 year ago

0.0.35

1 year ago

0.0.34

1 year ago

0.0.33

1 year ago

0.0.32

1 year ago

0.0.31

1 year ago

0.0.3

1 year ago

0.0.29

1 year ago

0.0.28

1 year ago

0.0.27

1 year ago

0.0.26

1 year ago

0.0.25

1 year ago

0.0.24

1 year ago

0.0.23

1 year ago

0.0.22

1 year ago

0.0.21

1 year ago

0.0.2

1 year ago

0.0.11113

1 year ago

0.0.11112

1 year ago

0.0.11111

1 year ago

0.0.1111

1 year ago

0.0.111

1 year ago

0.0.11

1 year ago

0.0.1

1 year ago