Add static-hostable support, by allowing changing the baseUrl at runtime #24
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug #: 70509237
Summary
Allow for the baseURL configuration, to be configurable at build-time, as well as runtime. This allows for the app, to be served from static file hostings that do not support URL rewrites, like Github Pages.
This PR utilizes already existing configurations from Vue CLI and Webpack.
Applied changes
/
).process.env.BASE_URL
is a standard way to set the base url for Webpack and Vue CLI, so we use it to prefix our url.var baseUrl
, allowing docc to inject a base url at runtime.index-template.html
file, for usage inside doccDependencies
swiftlang/swift-docc#44
Testing with the convert command
Steps:
npm run build
DOCC_HTML_DIR=/path/to/dist docc convert ./path/to/MyFramework.docc --static-hosting-base-path /myname/myrepo/ --transform-for-static-hosting
/myname/myrepo/
folder.http://localhost:[port]/myname/myrepo/documentation/my-framework
, it should render your docs.Testing with the process-archive command
npm run build
DOCC_HTML_DIR=/path/to/dist docc process-archive transform-for-static-hosting ./path/to/MyFramework.doccarchive --static-hosting-base-path /myname/myrepo/
/myname/myrepo/
folder.http://localhost:[port]/myname/myrepo/documentation/my-framework
, it should render your docs.Checklist
Make sure you check off the following items. If they cannot be completed, provide a reason.