Repository navigation
Load public svg resources by url - #230
Open
krisbreuker wants to merge 1 commit into
Open
krisbreuker wants to merge 1 commit into
krisbreuker wants to merge 1 commit into
Conversation
If an svg’s resource is set to a public module asset (`mod::mymodule/public/image.svg`), the svg is fetched directly client-side instead of being sent as a string. This way it can be cached by the browser if the same svg is used for multiple svg components.
unilynx
reviewed
Nov 12, 2026
| // Only fetch public module assets client-side; other resource urls (eg. webdesign web/ folders) aren't always served | ||
| STRING res_url; | ||
| IF (resource LIKE "mod::?*/public/*") { | ||
| res_url := GetModuleResourceURL(resource); |
Member
There was a problem hiding this comment.
you're going to check for existence in the next line of code, but if that fails you'll still send a URL to a resource you now know will trigger a 404 (and triggers dynamic page work)
This branch has not been deployed
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.
If an svg’s resource is set to a public module asset (
mod::mymodule/public/image.svg), the svg is fetched directly client-side instead of being sent as a string. This way it can be cached by the browser if the same svg is used for multiple svg components.Changes
<svg>component:LoadResource()now loads public module assets (mod::<module>/public/...) client-side from their/.wh/mod/<module>/public/...url instead of sending the SVG source inline, so the browser can cache it. The url gets a?mtime=<unix timestamp>of the file's modification time, so a changed SVG is fetched again. Other resources, such as webdesignweb/folders, are still sent inline.Testing
tollium.components.testsvg: two new steps.Deprecations and API changes
TODOs / FIXMEs