You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Vadim Filimonov a8c66cd1f4
Fix typos in 06-template-reference.md (#1562)
4 months ago
.github Fix issue template formatting 8 months ago
.vscode Fix TypeScript compilation errors 3 years ago
demo/clock Update demo to load polyfills and center the clock. 2 years ago
docs Fix typos in 06-template-reference.md (#1562) 4 months ago
src Fix flaky async-append test 9 months ago
test Fix trusted types tests. (#1193) 10 months ago
.clang-format Address review comments 4 years ago
.editorconfig Setup clang-format, tslint and editorconfig 4 years ago
.eslintignore Replace TSLint with ESLint (#969) 1 year ago
.eslintrc.json Replace TSLint with ESLint (#969) 1 year ago
.gitignore Use downlevel-dts, test compile in TS 3.4 (#1129) 1 year ago
.npmignore Add .npmignore to actually publish the lib/ dir 4 years ago
.travis.yml Update .travis.yml 1 year ago
CHANGELOG.md Prep 1.3.0 release 9 months ago
CODE_OF_CONDUCT.md G+ is shut down for consumers 2 years ago
CONTRIBUTING.md Fix typos in contributing doc 2 years ago
LICENSE Update LICENSE 4 years ago
README.md docs: fixed small error (#1180) 10 months ago
check-version-tracker.cjs Set type in package.json to "module" (#1146) 10 months ago
package-lock.json Add chromedriver as a devDependency 9 months ago
package.json Add chromedriver as a devDependency 9 months ago
rollup.config.js Update terser to drop all comments (#1094) 1 year ago
travis-bench.sh Attach tachometer checks to the right commit and distinguish with label. (#941) 2 years ago
tsconfig.json Add trusted types support to lit html (#970) 2 years ago
tslint.json Remove unnecessary type assertions (#846) 2 years ago
wct.conf.json Add flags to Chrome to reduce background throttling 1 year ago

README.md

lit-html

Efficient, Expressive, Extensible HTML templates in JavaScript

Build Status Published on npm Join our Slack Mentioned in Awesome lit-html

Documentation

Full documentation is available at lit-html.polymer-project.org.

Docs source is in the docs folder. To build the site yourself, see the instructions in docs/README.md.

Overview

lit-html lets you write HTML templates in JavaScript with template literals.

lit-html templates are plain JavaScript and combine the familiarity of writing HTML with the power of JavaScript. lit-html takes care of efficiently rendering templates to DOM, including efficiently updating the DOM with new values.

import {html, render} from 'lit-html';

// This is a lit-html template function. It returns a lit-html template.
const helloTemplate = (name) => html`<div>Hello ${name}!</div>`;

// This renders <div>Hello Steve!</div> to the document body
render(helloTemplate('Steve'), document.body);

// This updates to <div>Hello Kevin!</div>, but only updates the ${name} part
render(helloTemplate('Kevin'), document.body);

lit-html provides two main exports:

  • html: A JavaScript template tag used to produce a TemplateResult, which is a container for a template, and the values that should populate the template.
  • render(): A function that renders a TemplateResult to a DOM container, such as an element or shadow root.

Installation

$ npm install lit-html

Contributing

Please see CONTRIBUTING.md.