Add static-hostable support, by allowing changing the baseUrl at runtime#24
Merged
mportiz08 merged 3 commits intoswiftlang:mainfrom Dec 9, 2021
Conversation
Contributor
|
@swift-ci test |
mportiz08
approved these changes
Nov 19, 2021
Contributor
mportiz08
left a comment
There was a problem hiding this comment.
Great work Dobri! These changes will help anyone wanting to deploy generated docs to a non-root path of an existing website and be immediately impactful for GitHub Pages support.
|
Thank you for the great work. looking forward to see this merged, so that I can host the documentation on Github pages or S3 |
Contributor
|
@swift-ci test |
mportiz08
pushed a commit
to mportiz08/swift-docc-render
that referenced
this pull request
Dec 10, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_URLis 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.htmlfile, for usage inside doccDependencies
swiftlang/swift-docc#44
Testing with the convert command
Steps:
npm run buildDOCC_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 buildDOCC_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.