GithubHelp home page GithubHelp logo

joostk / lit-html Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lit/lit

0.0 1.0 0.0 3.13 MB

An efficient, expressive, extensible HTML templating library for JavaScript.

Home Page: https://lit-html.polymer-project.org/

License: BSD 3-Clause "New" or "Revised" License

TypeScript 96.47% HTML 2.21% JavaScript 0.55% Shell 0.77%

lit-html's Introduction

lit-html

Efficient, Expressive, Extensible HTML templates in JavaScript

Build Status Published on npm 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 youself, 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.

lit-html's People

Contributors

abdonrd avatar alexendoo avatar aomarks avatar arjunyel avatar bgotink avatar bicknellr avatar cdata avatar dakmor avatar dfreedm avatar fluorescenthallucinogen avatar graynorton avatar jridgewell avatar justinfagnani avatar keanulee avatar kevinpschaaf avatar larsdenbakker avatar mysticatea avatar patrickjs avatar rictic avatar ruphin avatar samuelli avatar simonfuhrmann avatar stramel avatar straversi avatar sunesimonsen avatar sunhuawei avatar usergenic avatar web-padawan avatar zeroliu avatar zhaoz avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.