-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
3 changed files
with
22 additions
and
5 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
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,8 +1,22 @@ | ||
import 'tonic-ssr' | ||
import { MainComponent } from './client.js' | ||
import jsdom from 'jsdom' | ||
|
||
export default () => { | ||
return (new MainComponent({ | ||
timestamp: 1611695921286 | ||
})).preRender() | ||
const { JSDOM } = jsdom | ||
|
||
const page = await (new MainComponent({ | ||
timestamp: 1611695921286 | ||
})).preRender() | ||
|
||
console.log({ page }) | ||
|
||
const dom = new JSDOM(`<!DOCTYPE html>${page}`) | ||
|
||
const body = dom.window.document.querySelector('body') | ||
const head = dom.window.document.querySelector('head') | ||
|
||
export default () => `<main-component>${body.innerHTML}</main-component>` | ||
|
||
export const vars = { | ||
head: head.innerHTML | ||
} |