Skip to content
/ web-components-ts Public template

A basic template for working with Web Components in Typescript.

Notifications You must be signed in to change notification settings

AlexW00/web-components-ts

Repository files navigation

Typescript Web Components starter template

This repo contains a basic template for working with Web Components in Typescript.

Features

Web Components allow you to create custom HTML elements that can be used in your web pages. This starter template contains basic classes to work with them. The template is:

  • ⚛️ Modular:
    • write HTML, CSS, and TypeScript in separate files
    • Models and ViewModels, keep the state separate from the DOM
  • 🪶 Minimal:
    • no external dependencies, only Vite and vanilla TypeScript
  • 💪 Powerful:
    • pubSub pattern for event handling and communication

Documentation:

-> see 📖 Documentation

Setup

  1. use the template to create your own repo
  2. clone your repo
  3. run npm install

Development

  1. run npm run dev
  2. make changes to the code

Build preview

  1. run npm run build
  2. run npm run preview and open the preview in a browser