ProjectEvergreen / greenwood

Greenwood is your workbench for the web, embracing web standards from the ground up to empower your stack from front to back.
https://www.greenwoodjs.io
MIT License
96 stars 9 forks source link

add support for configuring a base path #1116

Closed thescientist13 closed 9 months ago

thescientist13 commented 1 year ago

Type of Change

Feature

Summary

It is not uncommon for websites to be deployed at an "offset" URL from the root domain. For instance www.example.com/xyz. Most notably, GitHub Pages does this for project based site, as the full URL is a concatenation of the github.com domain and a path segment based on the repository name, and so <repository> is effectively the web root in this case.

http://<username>.github.io/<repository>

Note: by virtue of this feature request, it does require acknowledging that your current guide on using GitHub Pages is both out of date, and thus broken. Updating that guide should come immediately after introducing this feature.

Thus, it would require all assets to be relative that path segment, e.g.

Details

This should be doable but would require a few different parts of the system working together

  1. [ ] servers (local and prod) would need to account for this public path when resolving file paths to the filesystem
  2. [ ] Will need to handle updating <link>, <script>, etc tags accordingly when bundling
  3. [ ] Others I'm sure 😅

I wonder if this is something that setting a <base href="..."> tag could help with?