You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor!: make favicon generation settings-driven
Move favicon form work into a dedicated class.
Remove runtime fallback generation from page attachments.
Attach only existing favicon packages at runtime.
Add lifecycle docs and smoke coverage for the policy.
emulsify_favicon_smoke_assert($attachments['#attached']['html_head'] === [], 'Runtime page attachments should not add favicon metadata for missing packages.');
Emulsify 7.x generates a complete favicon package from one SVG source configured in the Drupal theme settings form for `emulsify` or an Emulsify child theme.
4
+
5
+
## Requirements
6
+
7
+
Generated PNG and ICO assets require both PHP extensions:
8
+
9
+
- GD
10
+
- Imagick
11
+
12
+
The uploaded source must be an SVG file with a square `viewBox`. If root `width` and `height` values are present, they must also describe a square. The generator accepts embedded raster image data inside the SVG, but the theme settings UI warns that fully vector sources usually scale more cleanly.
13
+
14
+
Source uploads are limited to 5 MB. The sanitized portable SVG copy is stored in theme config for portability; copies larger than 256 KB are allowed but flagged as review noise because they make config exports harder to inspect.
15
+
16
+
## Generated Package
17
+
18
+
Packages are written to the public files directory using a deterministic hash:
The hash is derived from the sanitized source SVG and favicon rendering settings. The package path, hash, timestamp, sanitized SVG source, and source filename are stored in `<theme>.settings` so the package can be regenerated in another environment after config import.
25
+
26
+
Each generated package contains:
27
+
28
+
-`favicon.svg`
29
+
-`favicon.ico`
30
+
-`favicon-96x96.png`
31
+
-`apple-touch-icon.png`
32
+
-`web-app-manifest-192x192.png`
33
+
-`web-app-manifest-512x512.png`
34
+
-`web-app-manifest-512x512-maskable.png`
35
+
-`site.webmanifest`
36
+
-`metadata.json`
37
+
38
+
`metadata.json` records the theme name, package hash, generation timestamp, source metadata, normalized favicon settings, source warnings, and generated file list. It is used as the package existence marker.
39
+
40
+
Do not manually edit generated package files. Change the source SVG or favicon settings, then regenerate the package so metadata, hash, and head attachments stay consistent.
41
+
42
+
## Lifecycle
43
+
44
+
Generated favicon packages are environment-local build artifacts. They are expected to exist in each deployed environment, but they should be recreated from configuration rather than treated as hand-maintained source files.
45
+
46
+
Generation happens only in these workflows:
47
+
48
+
1. Save the Emulsify Drupal theme settings form after configuring or changing favicon-related settings.
49
+
2. Run the Emulsify Tools Drush generate command after deploy or config import:
Use Emulsify Tools for deployment diagnostics and reset workflows:
56
+
57
+
```bash
58
+
drush emulsify_tools:favicon-status [theme_name]
59
+
drush emulsify_tools:favicon-reset [theme_name]
60
+
```
61
+
62
+
Normal page requests do not create, modify, or regenerate favicon files. At runtime, Emulsify only attaches head tags for an existing generated package. If the configured package path is missing, page rendering continues without generated favicon head tags until the theme settings form or Emulsify Tools command creates the package.
0 commit comments