Repository navigation
docs: put the PWA icon on the classpath in all projects - #6800
Conversation
Preview DeploymentThis PR has been deployed for preview. URL: https://docs-preview-pr-6800.fly.dev Changed pagesAdded content is highlighted in green; removed content is marked in red on each page.
Built from 6d0f472 |
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 2 comments.
| Finding | |
|---|---|
The "Overriding Generated Icons" step still tells non-Spring projects to use src/main/webapp/icons/, contradicting the new text above. |
|
Naming icons/icon.png as an equally valid classpath location leads to an icon that development mode never shows. |
There was a problem hiding this comment.
Around line 254 — could not attach to the exact diff line.
src/main/webapp/icons/, contradicting the new text above.
Line 254 keeps the old wording:
Add the image to
icons/in your static web resources (src/main/resources/META-INF/resources/icons/in Spring projects,src/main/webapp/icons/for non-Spring projects).
Twenty lines above, the page now says a servlet-context icon isn't used. A reader who reads both sections has to guess which answer is right for them.
The PR description says the page "now names src/main/resources/META-INF/resources/icons/ for all projects", but this second instruction list was left out.
The two cases really do differ: override images such as icon-1125x2436.png are plain static resources, served by StaticFileServer before PwaHandler (VaadinServlet.service(), flow-server), so src/main/webapp still works for them. If the difference is intentional, say so here; otherwise align the location.
pwa.adoc:254 · accuracy
There was a problem hiding this comment.
Aligned: the override step now says to add the image to src/main/resources/META-INF/resources/icons/, next to icon.png. Override images are plain static files, so src/main/webapp/icons/ would still work for them, but one location for all icon files avoids the contradiction you pointed out. The PR description now mentions this step too.
|
|
||
| Vaadin automatically scans for an image named [filename]`icon.png` in the `*/icons*` folder in the `webapp` resources folder. | ||
| It uses this image to create appropriately sized images for different devices. | ||
| The production build looks for the icon on the classpath only, at [filename]`icons/icon.png` or [filename]`META-INF/resources/icons/icon.png`, and generates appropriately sized icons for different devices from it. |
There was a problem hiding this comment.
icons/icon.png as an equally valid classpath location leads to an icon that development mode never shows.
The production build looks for the icon on the classpath only, at [filename]
icons/icon.pngor [filename]META-INF/resources/icons/icon.png
Both paths work for the build (TaskGeneratePWAIcons.findIcon()), but only the second works at runtime: PwaRegistry.getResourceUrl() checks the servlet context and then /META-INF/resources/ + path, nothing else. A reader who picks the shorter path and puts the icon in src/main/resources/icons/icon.png gets the Vaadin logo in development — the mirror image of the bug this PR fixes.
Suggestion: drop the bare path and write "The production build reads the icon from the classpath only, at META-INF/resources/icons/icon.png, and generates appropriately sized icons for different devices from it."
pwa.adoc:235 · accuracy
There was a problem hiding this comment.
Agreed. The sentence now names only META-INF/resources/icons/icon.png, which works both for the production build and in development mode, so readers can't pick the bare icons/icon.png path that development mode doesn't find.
The PWA page told non-Spring projects to put the custom icon in
src/main/webapp/icons/. The production build looks for the icon on the classpath only, so an icon there is ignored and production apps show the Vaadin logo. Development mode can still show it, which makes the problem easy to miss.src/main/resources/META-INF/resources/icons/for all projects and says that a servlet-context-only icon isn't used.META-INF/resources/icons/icon.pngas the classpath location, since that path also works in development mode.src/main/webapp/icons/still works for them; it's dropped only for consistency.Related to vaadin/flow#27497. vaadin/flow#27506 makes development mode read the icon from the classpath only too.
Working on behalf of @Artur-