Elderjs / elderjs

Elder.js is an opinionated static site generator and web framework for Svelte built with SEO in mind.
https://elderguide.com/tech/elderjs/
MIT License
2.11k stars 52 forks source link

Build output doesn't work locally by default (href <link> are absolute) #248

Open Stijn-B opened 2 years ago

Stijn-B commented 2 years ago

The href attribute of <link> tags is an absolute url like href=/path/to/file. As a result those files aren't loaded when opening the build result (public/index.html) locally during development. This is fixed by making the urls relative like href=./path/to/file.

I don't know if making the urls relative during building would lead to unwanted effects in production. If not, it might be a nice quality of life improvent; you can check locally whether your build output behaves as expected. (Personally, when opening the build output, at first I thought I did something wrong because the css styling didn't load but it was just this detail)

eight04 commented 1 year ago

If you use Elderjs/template, try the serve command: https://github.com/Elderjs/template/blob/8d3ba83efa9c14e70fc69cb4c30d9d0c42ca8483/package.json#L12

IIRC, path logic are located everywhere so this feature may require some refactoring.