зеркало из https://github.com/github/lit-html.git
Add a "Getting Started" section.
This commit is contained in:
Родитель
1eb0baf087
Коммит
4efd86314c
54
README.md
54
README.md
|
@ -37,6 +37,60 @@ render(helloTemplate('Kevin'), document.body);
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
Lit is based on ES6 Modules. If you're using NPM in your project, installing and using Lit is straightforward:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> npm install lit-html
|
||||||
|
```
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script
|
||||||
|
type="module"
|
||||||
|
src="node_modules/lit-html/lit-html.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you'd prefer not to use NPM, hot-loading Lit from [`unpkg.com`] is straightforward:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script
|
||||||
|
type="module"
|
||||||
|
src="https://unpkg.com/lit-html@0.7.1/lib/lit-extended.js?module"
|
||||||
|
></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
|
Importing from your module script is similarly straightforward:
|
||||||
|
|
||||||
|
```html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="module">
|
||||||
|
import { html, render} from
|
||||||
|
"https://unpkg.com/lit-html@0.7.1/lib/lit-extended.js?module";
|
||||||
|
// ...
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
```
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
`lit-html` has four main goals:
|
`lit-html` has four main goals:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче