Skip to content

Commit

Permalink
clarify README example
Browse files Browse the repository at this point in the history
  • Loading branch information
thescientist13 committed Jun 23, 2022
1 parent ccfe3a5 commit 0f6e5a0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/plugin-renderer-lit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,19 @@ export default {

Now, you can write some [SSR routes](/docs/server-rendering/) using Lit including all the [available APIs](docs/server-rendering/#api). The below example uses the standard [SimpleGreeting](https://lit.dev/playground/) component from the Lit docs by also using a LitElement as the `default export`!
```js
import fetch from 'node-fetch';
import { html, LitElement } from 'lit';
import './path/to/greeting.js';

class ArtistsPage extends LitElement {
export default class ArtistsPage extends LitElement {

constructor() {
super();
this.artists = JSON.parse(fs.readFileSync(new URL('./artists.json', import.meta.url), 'utf-8'));
this.artists = [{ /* ... */ }];
}

render() {
const { artists } = this;

return html`
${
artists.map((artist) => {
Expand All @@ -72,7 +73,7 @@ class ArtistsPage extends LitElement {
<simple-greeting .name="${name}"></simple-greeting>
</a>
<img src="${imageUrl}"/>
<img src="${imageUrl}" loading="lazy"/>
<br/>
`;
Expand All @@ -82,10 +83,9 @@ class ArtistsPage extends LitElement {
}
}

// for now these are needed for the Lit specific implementations
customElements.define('artists-page', ArtistsPage);

export const tagName = 'artists-page'; // this is needed for Lit specific implementations
export default ArtistsPage;
export const tagName = 'artists-page';
```

## Options
Expand Down

0 comments on commit 0f6e5a0

Please sign in to comment.