-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make font configurable, improve asset handling and use basic frontend bundle splitting #1167
Merged
Commits on May 15, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 42113e3 - Browse repository at this point
Copy the full SHA 42113e3View commit details -
Update
reinda
and improve asset handlingThis finally (!!) revamps our asset handling. We use reinda, which does a lot for us, but it had some limitations before. Specifically, it could not embed files by wildcard pattern and files could not be added purely at runtime. This made frontend code splitting and including custom fonts impossible. To improve this, reinda was almost completely rewritten. The most important changes from reinda and this commit: - No more reinda templates: it has been replaced by the "modifier" API in reinda, which gives Tobira more control. This gets rid of the million manual variables in our index.html. - The `embed!` macro only mentions files that are actually embedded into the executable. Logos for example are added at runtime, without a weird "path_override". - The compression of embedded assets is now done with brotli, which should result in a smaller binary. - The "logo fallback logic" is now performed in the frontend. This is more convenient for us and avoids duplicating the logo contents in memory. - Fonts and Paella icons are embedded by wildcard now, so we don't have to list every darn file anymore. I am slightly uneasy as this means in the future, we might accidentally include unneeded files there. I don't think reinda's API is "perfect" now. My main complain is the duplication of paths/filenames. But we want to ship that at some point and I think the API works well enough. The duplication here is unlikely to result in bad bugs that are only noticed late. NOTE: This does not restore full previous functionality yet! Two things are missing: - The font paths in `fonts.css` are not adjusted and broken. - The frontend code map is not included yet. Both of these will be fixed in the next commits.
Configuration menu - View commit details
-
Copy full SHA for f9f0a1a - Browse repository at this point
Copy the full SHA f9f0a1aView commit details -
Admins can modify the `font-family` used by Tobira, they can specify font files that Tobira will serve, and they can specify extra CSS code that can add more `@font-face` declarations. This should be a simple and flexible system to configure custom fonts.
Configuration menu - View commit details
-
Copy full SHA for 74c6f56 - Browse repository at this point
Copy the full SHA 74c6f56View commit details -
Enable frontend bundle code splitting (Paella as own bundle)
This is the first step to using code splitting to reduce the loaded JS size. This commit lays the ground work but only splits the bundle into two files. But that's already a big win as it cuts the size of JS one has to download to render the main page roughly in half. Even if there is a player on the main page, the page already renders once the main bundle is loaded, and the player shows a placeholder spinner. In the future, we can create more bundles, e.g. moving everything "manage" related to another bundle or even just letting webpack decide.
Configuration menu - View commit details
-
Copy full SHA for 43a02e3 - Browse repository at this point
Copy the full SHA 43a02e3View commit details -
Use webpack-html-plugin to insert bundle path instead of backend
This is more straight forward. Before this commit, the setup was broken as the "find main bundle" code in `assets.rs` was incorrect. It only iterated over files embedded at compile time, which might be missing the bundle. But more: if the frontend was changed, the hash and thus filename of the main bundle changed as well, and the backend replacement would be incorrect. Letting webpack handle this part seems simpler. This commit also deduplicates some strings in `assets.rs`.
Configuration menu - View commit details
-
Copy full SHA for 4bd24e9 - Browse repository at this point
Copy the full SHA 4bd24e9View commit details -
Configuration menu - View commit details
-
Copy full SHA for cd58b76 - Browse repository at this point
Copy the full SHA cd58b76View commit details -
Configuration menu - View commit details
-
Copy full SHA for 2e1a9f9 - Browse repository at this point
Copy the full SHA 2e1a9f9View commit details
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.