-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194cbb4
commit b9e0e36
Showing
17 changed files
with
964 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/usr/bin/env node | ||
import cli from '../dist/index.js' | ||
import cli from '../dist/cli.js' | ||
|
||
cli() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { LitElement, css, html } from 'lit'; | ||
|
||
export class SimpleGreeting extends LitElement { | ||
name: string; | ||
|
||
static properties = { | ||
name: {}, | ||
}; | ||
|
||
// Define scoped styles right with your component, in plain CSS | ||
static styles = css` | ||
:host { | ||
color: blue; | ||
} | ||
`; | ||
|
||
constructor() { | ||
super(); | ||
// Declare reactive properties | ||
this.name = 'World'; | ||
} | ||
|
||
// Render the UI as a function of component state | ||
render() { | ||
return html`<p>Hello, ${this.name}!</p>`; | ||
} | ||
} | ||
|
||
customElements.define('simple-greeting', SimpleGreeting); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import path from 'node:path' | ||
import Koa from 'koa' | ||
|
||
import { run } from '../../dist/index.js' | ||
|
||
import {render} from '@lit-labs/ssr' | ||
|
||
const __dirname = path.dirname(new URL(import.meta.url).pathname) | ||
const app = new Koa() | ||
|
||
app.use(async (ctx) => { | ||
if (ctx.path === '/favicon.ico') { | ||
return | ||
} | ||
|
||
ctx.body = await run(/*js*/` | ||
import {render} from '@lit-labs/ssr'; | ||
import {html} from 'lit'; | ||
import './component.ts'; | ||
const dom = await render(html\`<simple-greeting></simple-greeting>\`); | ||
export default Array.from(dom).join('\\n') | ||
`, { | ||
browserName: 'chrome', | ||
rootDir: __dirname | ||
}) | ||
}) | ||
|
||
app.listen(3000) | ||
console.log('Server running at http://localhost:3000/'); |
Oops, something went wrong.