Skip to content

docs: put the PWA icon on the classpath in all projects - #6800

Merged
peholmst merged 4 commits into
mainfrom
docs/pwa-icon-classpath
Dec 2, 2026
Merged

peholmst merged 4 commits into
mainfrom
docs/pwa-icon-classpath

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • The PWA page now names src/main/resources/META-INF/resources/icons/ for all projects and says that a servlet-context-only icon isn't used.
  • The PWA page names only META-INF/resources/icons/icon.png as the classpath location, since that path also works in development mode.
  • The "Overriding Generated Icons" steps now name the same folder, so all icon files live in one place. Override images are plain static files, so src/main/webapp/icons/ still works for them; it's dropped only for consistency.
  • The app icon guide now names the same location, also for WAR projects.

Related to vaadin/flow#27497. vaadin/flow#27506 makes development mode read the icon from the classpath only too.

Working on behalf of @Artur-

@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6800.fly.dev

Changed pages

Added content is highlighted in green; removed content is marked in red on each page.

Built from 6d0f472

@peholmst
peholmst marked this pull request as ready for review December 2, 2026 08:52

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Around line 254 — could not attach to the exact diff line.

⚠️ The "Overriding Generated Icons" step still tells non-Spring projects to use 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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread articles/flow/configuration/pwa.adoc Outdated

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Naming 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.png or [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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@peholmst
peholmst merged commit 5044473 into main Dec 2, 2026
13 of 15 checks passed
@peholmst
peholmst deleted the docs/pwa-icon-classpath branch December 2, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants