[PHP API Reference] Reduce size of PHP API reference #3008
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.
Currently, the PHP API reference takes more than 8gb on the disk. With MkDocs build, it's another 8 gb in the
sitedirectory -> more than 16gb for a single copy of the doc.Very often I work on multiple PRs in parallel and I'm running out of disk space to continue some topics.
This also results in slower checkout and clone times when working with the doc.
The size of the repository is caused by our PHP API reference - 3k files, each almost 3mb in size, results in ~8gb of content (that gets doubled after MkDocs built).
This solution extract the common part of each file (the navigation) to a separate file that is loaded using JavaScript.
Advantages:
Disclaimer: I have used AI when writing the code, but I've verified the output (both of the script and the end result) and it works.
When reviewing, review 38bc22b first - and then verify the second commit locally (it's autogenerated).
Link to PHP API ref: https://ez-systems-developer-documentation--3008.com.readthedocs.build/en/3008/api/php_api/php_api_reference/
Individual file before:
https://github.com/ibexa/documentation-developer/blob/5.0/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-ActivityLog-Values-ActivityLog-Criterion-LogicalAnd.html
Individual file after:
https://github.com/ibexa/documentation-developer/blob/optimize-php-api-ref/docs/api/php_api/php_api_reference/classes/Ibexa-Contracts-ActivityLog-Values-ActivityLog-Criterion-LogicalAnd.html
(becomes actually viewable on GitHub)
Tested scenarios: