I have opened the Feature Discussion for the embeds: Embed static files on the server
I also took a look at our server code and it should be fairly easy to add a publicPath option (npx frontity build --publicPath="https://some.path"
) but we had the idea of exposing the whole Webpack configuration for both projects and packages through a frontity.config.js
file.
Changing the publicPath
would look like this:
// frontity.config.js
export const webpack = ({ config }) => {
config.output.publicPath = "https://some.path";
}
Of course you can use env variables in that file too:
export const webpack = ({ config }) => {
if (process.env.PUBLIC_PATH)
config.output.publicPath = process.env.PUBLIC_PATH;
}
I have opened a Feature Discussion for that too: Customize Webpack configuration
Finally, I thought about a 5th possibility:
- Allow different SSR and static urls in the PHP Theme Builder.
The URLs could be:
- SSR:
https://us-central1-your-account.cloudfunctions.net/frontity
- Static:
https://storage.cloud.google.com/your-frontity-bucket
*
*Iām not sure if that is a valid G Storage URL but you can get the idea.
The PHP Theme Bridge would be in charge of using one URL or the other when requests are for the /static/
folder (Static URL) or for anything else (SSR URL).
This is different than the 3rd option in the sense that in this case it would be WordPress the one serving those assets, with the same final URL and the same CDN configuration.
@stevepersch let me know what you think about all these options