Asset prefix for static files #4123
Replies: 3 comments 13 replies
-
Thanks This is currently not possible. What is your motivation to have this feature exactly? What's the motivation to have HTML files on one domain, and JS files on another? Note Amazon S3 is not a CDN, only CloudFront is. |
Beta Was this translation helpful? Give feedback.
-
I've been following following this discussion all the time, more or less.
I didn't take the time to explain as I've been focusing on other things, it wasn't really important enough, but there is a reason.
The reason I initially asked whether this was possible, hasn’t been mentioned yet: cookies. Docusaurus as an SSG already outputs nothing but static assets (HTML, CSS, and JS) which you can just deploy to some service like S3 or Azure SWA — there is no need to separate those files from some server-rendered content because there is no server-rendered content — if you do not host those static files on the same domain. Suppose a company has a heavy web-app that sets 3 kB of cookies1 at For the cookies to be sent to the server of the web-app, their path must be set to That's not really a great deal, but eliminating it increases page speed a bit (at least on slower devices or networks). Hope this clarifies my question a bit. Congrats on v2 (and 2.2 already)! Footnotes
|
Beta Was this translation helpful? Give feedback.
-
Now, this requirement can be fulfilled by writing a custom plugin and utilizing |
Beta Was this translation helpful? Give feedback.
-
Is it possible to have an asset prefix in Docusaurus?
For example: having static files (
.js
,.css
,.png
etc.) served fromhttps://cdn.example.com
, while the docs are available athttps://docs.example.com
.This feature is inspired on Gatsby's
assetPrefix
setting, and is useful when using a service like S3.Thanks for this great documenting tool!
Beta Was this translation helpful? Give feedback.
All reactions