[Docs] reload api js files on change #13313
Merged
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.
Summary
This PR changes the documentation to be able to re-load the api js file to reflect any changes, previously api would be reload-able, but the reload would not reflect any changes from the original js file, only if the pug files were changed
in more detail:
parse
function indocs/source/api
to be in 3 different functions:processFile
parseFile
parseAllFiles
docs/source/api
(because it only needs to be loaded once and on reload would need to reload the anyway)scripts/website
to be able to use the reload functiondocs/source/utils.js
from a previous PRPS: the current approach is a little "hacky" because the
docs/source/api
file will always load it once at file-load time and the file-mapdocs/source/index
will always store this one value and not update on reload, but thefilemap.apiDocs
value will update, this means that unless specifically loaded, the file-maps value will never update beyond the initial load - which should not pose a problem with the way the documentation is currently done (and for any scripts which will not make use of reload)