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.
 
 
 
 
Nicolás Font 167ac78c2c
Fix typos in 03-styling-templates.md (#1511)
6 days ago
.github Fix issue template formatting 3 months ago
.vscode Fix TypeScript compilation errors 2 years ago
demo/clock Update demo to load polyfills and center the clock. 2 years ago
docs Fix typos in 03-styling-templates.md (#1511) 6 days ago
src Fix flaky async-append test 5 months ago
test Fix trusted types tests. (#1193) 6 months ago
.clang-format Address review comments 3 years ago
.editorconfig Setup clang-format, tslint and editorconfig 3 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) 10 months ago
.npmignore Add .npmignore to actually publish the lib/ dir 3 years ago
.travis.yml Update .travis.yml 11 months ago
CHANGELOG.md Prep 1.3.0 release 5 months ago
CODE_OF_CONDUCT.md G+ is shut down for consumers 1 year ago
CONTRIBUTING.md Fix typos in contributing doc 1 year ago
LICENSE Update LICENSE 3 years ago
README.md docs: fixed small error (#1180) 6 months ago
check-version-tracker.cjs Set type in package.json to "module" (#1146) 6 months ago
package-lock.json Add chromedriver as a devDependency 5 months ago
package.json Add chromedriver as a devDependency 5 months ago
rollup.config.js Update terser to drop all comments (#1094) 11 months ago
travis-bench.sh Attach tachometer checks to the right commit and distinguish with label. (#941) 1 year ago
tsconfig.json Add trusted types support to lit html (#970) 1 year ago
tslint.json Remove unnecessary type assertions (#846) 1 year ago
wct.conf.json Add flags to Chrome to reduce background throttling 11 months 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.