|
2 | 2 |
|
3 | 3 | ## 4.19.0-beta.0 |
4 | 4 |
|
5 | | -### BREAKING CHANGES by inlining SVG only |
| 5 | +### 🔥 BREAKING CHANGES by inlining SVG only |
6 | 6 |
|
7 | 7 | - Inline `<img src="icon.svg">`: |
8 | 8 | - OLD: replaces `<img>` with `<svg>` tag |
9 | | - - NEW: inlines SVG as escaped data URL |
| 9 | + - NEW: inlines SVG as base64-encoded data URL. Use new `svg.inline.embed = true` option to keep old behaviour. |
10 | 10 | - Encoding of data URL: |
11 | 11 | - OLD: defaults, escaped URL (`#%` chars only), e.g. `data:image/svg+xml,<svg>...</svg>` |
12 | | - - NEW: defaults, base64 encoded, e.g. `data:image/svg+xml;base64,iVBO` or full escaped URL, e.g. `data:image/svg+xml,%3Csvg%20` regards `generator.dataUrl.encoding` option |
| 12 | + - NEW: defaults, base64 encoded, e.g. `data:image/svg+xml;base64,iVBO` or full escaped URL, e.g. `data:image/svg+xml,%3Csvg%20` regards `generator.dataUrl.encoding` option. |
| 13 | + |
| 14 | + |
| 15 | +### ✨ Feature |
| 16 | + |
| 17 | +New `svg` plugin option: |
| 18 | + |
| 19 | +```ts |
| 20 | +type SvgOptions = { |
| 21 | + enabled?: boolean; |
| 22 | + // RegEx to match SVG files. |
| 23 | + // Defaults `/\.svg/i`. |
| 24 | + test?: RegExp; |
| 25 | + inline?: { |
| 26 | + // Enable inline SVG by replacing <img> with <svg>, only in HTML. |
| 27 | + // Equivalent to query: `?inline=embed` | `?embed`. |
| 28 | + // Defaults `false`. |
| 29 | + embed?: boolean; |
| 30 | + // Data URL encoding, overrides `generator.dataUrl.encoding` option. |
| 31 | + // Equivalent to query: `?inline=base64` | `?inline=escape`. |
| 32 | + // Defaults the `generator.dataUrl.encoding` option, if undefined then `base64`. |
| 33 | + encoding?: 'base64' | false; |
| 34 | + }; |
| 35 | +}; |
| 36 | +``` |
| 37 | + |
| 38 | +### Bugfix |
| 39 | + |
| 40 | +Consider `generator.dataUrl()` and `generator.dataUrl.encoding` Webpack options. |
13 | 41 |
|
14 | 42 | ## 4.18.2 release (2025-02-20) |
15 | 43 |
|
|
0 commit comments