-
Notifications
You must be signed in to change notification settings - Fork 6
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
bau css to support SSR? #102
Comments
bau-css already supports SSR, examples can be found in bausaurus, a Static Site Generator. |
@FredericHeem can you clarify how it works? |
"window" and "document" are mocked by jsdom bau/bausaurus/src/server/renderPage.js Line 158 in 7149d9c
Then feeded into createContext: const context = createContext({
window: dom.window,
config: { base: viteConfig.base },
}); |
@FredericHeem thanks. Makes sense. I wonder if adding this SSR example to bau-css readme could be helpful. Another question, I see that it adds "style" element for each classname with a matching class id and then uses that to check if the styles were already added in the future. I wonder if it would be better for bundle size during SSR to use one style tag for all styles (i.e <style id="bau-css" >) and use smth like JS Set or object ( |
bau css looks simple and neat. Very similar to how goober does things with reduced complexity.
Any plans to support SSR?
The way goober does it they use "context" object when "window" or "document" is not availalble and then "renderToString" method that basically reads from that context for SSR
Example
The text was updated successfully, but these errors were encountered: