I want index.html use .js like <href="js/xxx.js"> not <href="/js/xxx.js">.
I'm use
xcodebuild docbuild -scheme MyScheme -destination 'generic/platform=iOS'
get xxx.doccarchive.
then I try
xcrun docc process-archive transform-for-static-hostin
xxx.doccarchive
--output-path ./output
--hosting-base-path ""
but not useful.
And I try script like:
#!/bin/bash
sed -i ''
-e "s|(href=['"])/|\1${prefix}|g"
-e "s|(src=['"])/|\1${prefix}|g"
-e "s|(['"]/(css|js|data|images|theme-settings.json)/)|\1${prefix}|g"
"$file"
but when hosting in server,webview has tip "An unknown error occurred".
I think what you're asking is for the HTML that's part of the docc-render Javascript app to use relative URL references rather than being pinned to the root of whatever is serving the pages.
The short form is basically "won't work, it'll break the documentation, especially when used with static hosting". (as you've seen)
The longer version:
DocC's content is all rendered from a Vue.js app, which reads the core details is needs from a set of JSON files embedded within the catalog. The reason is breaks has to do with how to wrangle extended URLS in Vue.js app while using static hosting.
If you look at the content for all the .html files that are scattered about inside the resulting archive under documentation/, you'll see they're all the same - they're placeholders for a static hosting server to present the Vue.js app. Since those URLs can be deeply nested, a single location is almost required to get the expected result (where you can load a URL deep within a catalog and see the relevant content rendered). Without those HTMl files with the stub to load the Vue.js app, the static hosting site would return a 404.
If you get to experimenting with how to manipulate the results, I recommend two things:
First enable the JS debugger in your browser, as it helped me understand what was happening and what didn't load correctly when I was manually mangling docc archives to experiment.
Second, take some time to really look through the Vue.js app (source for which is in the swift-docc-render repository. There's a lot there, but understanding what's being used there can help maybe guide you to solutions for whatever issue you were trying to handle.