Skip to content

Commit

Permalink
Remove hydrate-plenti ID and target html element (#65).
Browse files Browse the repository at this point in the history
  • Loading branch information
jimafisk committed Sep 21, 2020
1 parent 6b1c9ba commit e247d57
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions cmd/build/data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ func DataSource(buildPath string, siteConfig readers.SiteConfig) {
}
// Get the string value of the static HTML.
renderedHTMLStr := renderedHTML.String()
// Inject ID needed for hydrating the SPA.
renderedHTMLStr = strings.Replace(renderedHTMLStr, "<html ", "<html id='hydrate-plenti' ", 1)
// Inject the main.js script the starts the client-side app.
renderedHTMLStr = strings.Replace(renderedHTMLStr, "</head>", "<script type='module' src='https://unpkg.com/dimport?module' data-main='/spa/ejected/main.js'></script><script nomodule src='https://unpkg.com/dimport/nomodule' data-main='/spa/ejected/main.js'></script></head>", 1)
// Convert the string to byte array that can be written to file system.
Expand Down
2 changes: 1 addition & 1 deletion ejected/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Router from './router.svelte';

let target = document.querySelector('#hydrate-plenti').parentNode;
let target = document.querySelector('html').parentNode;

new Router({
target: target,
Expand Down
2 changes: 1 addition & 1 deletion generated/ejected.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ staticBuildStr.forEach(arg => {
});`),
"/main.js": []byte(`import Router from './router.svelte';
let target = document.querySelector('#hydrate-plenti').parentNode;
let target = document.querySelector('html').parentNode;
new Router({
target: target,
Expand Down

0 comments on commit e247d57

Please sign in to comment.