-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
simplify svelte plugin #1221
simplify svelte plugin #1221
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,17 +45,10 @@ module.exports = function plugin(snowpackConfig, pluginOptions = {}) { | |
}) | ||
).code; | ||
} | ||
// COMPILE | ||
const ssrOptions = {}; | ||
if (isSSR) { | ||
ssrOptions.generate = 'ssr'; | ||
ssrOptions.hydratable = true; | ||
ssrOptions.css = true; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea here was that CSS would be applied via JS directly in Svelte, so that you wouldn't need to handle our There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Any SSR solution will need to extract CSS, and either serve it as a file, consumed via a const { html, css } = App.render(props);
return `<!doctype html>
<head>
<style}${css.code}</style>
</head>
<body>
${html}
</body>`; |
||
} | ||
|
||
const {js, css} = svelte.compile(codeToCompile, { | ||
...svelteOptions, | ||
...ssrOptions, | ||
generate: isSSR ? 'ssr' : 'dom', | ||
outputFilename: filePath, | ||
filename: filePath, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I must have misunderstood this. Isn't the idea that
hydratable
is needed in SSR mode so that it generated hydratable markup, so that the client-side code can hydrate the SSR-generated markup?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No,
hydratable
just means that the client-side component is generated with the code necessary to hydrate the server-rendered markup. There aren't any constraints on the markup that it hydrates, it will repair the DOM as necessary