litter-g - Vaadin Add-on Directory
Use lit-html inside an html element[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/litter-g)
# litter-g
## Use Case
The use case for litter-g is spelled out quite nicely by [React's introductory pages](https://reactjs.org/docs/add-react-to-a-website.html):
>The majority of websites aren’t, and don’t need to be, single-page apps. With a few lines of code and no build tooling, try React in a small part of your website. You can then either gradually expand its presence, or keep it contained to a few dynamic widgets.
In one of their [examples](https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html) they show how you can use React inside a script tag. litter-g does something similar, but with lit-html.
Note: litter-g hopes to improve on the ergonomics of a similar component, [xtal-method](https://www.webcomponents.org/element/xtal-method). Both components are meant for applications that aren't necessarily built on a JavaScript-centric paradigm. Applications that may be built using a server-centric framework, which just wants to strategically shake some JavaScript pixie dust as needed. Or maybe applications that are built using some "old" framework like Cold Fusion, but want to slowly convert into something more modern.
## Syntax
The litter-g web component only affects things that happen within its ShadowDOM realm. Or, if you place it outside any ShadowDOM, it only affects things outside any ShadowDOM.
```html
...
```
-->
## References
A natural question arises -- where to get the lit-html references from? Out of the box, litter-g just hardcodes some fine-for-development defaults:
```JavaScript
import {html, render} from 'https://cdn.jsdelivr.net/npm/lit-html/lit-html.js';
import {repeat} from 'https://cdn.jsdelivr.net/npm/lit-html/lib/repeat.js';
```
However, if you want to use this in production, or if you want to access more of lit's directives, it would be best to create your own references to some (bundled) files that best meet your target browser / geography.
To do this, create a string constant in document.head, which provides your prefered imports. For example:
```JavaScript
self['litImports'] = `
import {render, html} from '//unpkg.com/lit-html?module'
`
```
Then in your litter-g tag, specify which constant to use for imports:
```html
Longitude: