vike: Allow returning string (unsafe) from render
I would like to be able to return a string (unsafe) from a server render without having to sanitize with the html export, perhaps this could be an opt-in config option?
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 39 (23 by maintainers)
Commits related to this issue
- make `pageAsset` and `injectAssets` available privately as `pageContext._pageAsset` and `html._injectAssets` (#92) — committed to vikejs/vike by brillout 3 years ago
- support chaining `html.dangerouslySkipEscape(await html._injectAssets(str, pageContext))` (#92) — committed to vikejs/vike by brillout 3 years ago
- tests: add example of using `html.dangerouslySkipEscape(await html._injectAssets(str, pageContext))` (#92) — committed to vikejs/vike by brillout 3 years ago
- improve error message when wasn't applied to HTML (#92) — committed to vikejs/vike by brillout 3 years ago
Released in
0.1.2.See
html._injectAssets()andpageContext._pageAssetsin https://github.com/brillout/vite-plugin-ssr/tree/master/examples/custom-server-render-integration.I added the prefix
_to communicate that these are non-documented beta features subject to breaking changes. For now you are the only one using them and I’ll let you know if there is a breaking change.After a while we will remove the prefix and add documentation.
Yea I’ve done a pretty deep internal refactor which I’ve been wanting to do for quite some time. The neat thing here is that everything revolves around
pageContextnow internally as well.I’m 97% done, I’ll release tomorrow 😃
Tomorrow, hopefully 😃
I’ll release the solution tentatively tomorrow.
No because you have full control over what’s happening in the client.
The
html.injectAssetsactually injects your.page.client.jsscript.AFAICT exposing
injectAssetsto users should do the trick.