-
Notifications
You must be signed in to change notification settings - Fork 2
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
JS-dependent styling #322
Comments
Tentative workaround for SSR failing with babel-plugin-transform-scss: add this extra nashornPolyfill:
This will produce un-styled output from SSR: styling is not applied before client-side rendering (hydration) is run. Consequences: in cases where hydration is disabled (eg. in CS edit mode when passing in the recommended |
There is a possible workaround for the problem with styling in content studio, tried for the Material UI framework MUI. In the XP controller, when calling the react4xp
Several things to note around this though: This does not solve issues around JS calls that break server side rendering, those must be solved separately (eg. skipping SSR entirely with Also: usually, react4xp uses Firstly, this may cause a worse user experience for content studio editors, since the react components are now always active/clickable in the previews, and this may interfere with working with react4xp-rendered parts and layouts the WYSIWYG page builder. Secondly, in early testing of react4xp, some cases were found where react4xp's client-side JS from the pagecontributions interfered with the JS of content studio itself and sometimes breaking stuff. It's unclear whether this is still an issue in current versions of XP / content studio / react4xp, but it's recommended to keep an eye out for this and test thoroughly. With this in mind, this workaround may still be a viable option for some. |
This hit me hard with Is there a way to unset document? My polifyll for this to get this to work was as follows:
Now it displays in Content Studio, but it doesn't look nice. |
Related #780 |
This polyfill is not needed anymore since document has been removed #738 |
We plan to support If one sets ssr: false (only client-side rendering), then (side-note: Content Studio Edit Mode won't work) |
Solutions where styling at runtime is based on javascript (such as https://cssinjs.org/?v=v10.9.0 or babel-plugin-transform-scss) is currently not supported. Two issues around that:
document.querySelector
etc). When run as SSR, it fails.The text was updated successfully, but these errors were encountered: