Change publicPath dynamically at runtime

Description

After Change publicPath is implemented, the only way to change the publicPath would be in the npx frontity build process. It’d be great if we also allow people to change it dynamically, at runtime.

Requirements

  • Let users change the public path dynamically using a Frontity Query Options like ?frontity_public_path=/custom.
  • Let users change the public path dynamically using their frontity.settings.js.
  • Let packages change the public path dynamically with their own logic using beforeSSR or afterSSR functions.
  • Fallback to the public path defined during the build with --public-path=/custom.
  • Fallback to the default /static folder.

Other considerations:

  • If we are going to populate state.frontity.options.publicPath, it would be great if it always contains the value of the public path, even if this was not populated via the state (frontity.settings.js or afterSSR) or a Frontity Query Option.

Possible solution

Resources