|
1 | 1 | # Changelog |
2 | 2 |
|
3 | | -## 4.19.0-beta.5 |
4 | | - |
5 | | -- feat: if ?inline query is not specified, dataURL is a result of generator.dataUrl() function. |
6 | | - The encoding can be specified using a query value (`base64` or `escape`). |
7 | | - |
8 | | -## 4.19.0-beta.4 |
9 | | - |
10 | | -- feat: display a warning when used `embed` URL query for SVG files in JS or CSS |
11 | | - |
12 | | -## 4.19.0-beta.3 |
13 | | - |
14 | | -- fix: apply the encoding specified in the query to the data URL of an SVG for files imported in JS |
15 | | - ```js |
16 | | - import svg from './icons.svg?inline=base64'; // <= use exactly this encoding, independ how is specified anywhere global |
17 | | - ``` |
18 | | -- fix: the output SVG should contain the changes made in generator.dataUrl() |
19 | | -- docs: add information about preload priority to readme |
20 | | - |
21 | | -## 4.19.0-beta.0 - 4.19.0-beta.2 |
| 3 | +## 4.19.0 |
22 | 4 |
|
23 | 5 | ### 🔥 BREAKING CHANGES by inlining SVG only |
24 | 6 |
|
25 | 7 | - Inline `<img src="icon.svg">`: |
26 | 8 | - OLD: replaces `<img>` with `<svg>` tag |
27 | | - - NEW: inlines SVG as base64-encoded data URL. Use new `svg.inline.embed = true` option to keep old behaviour. |
| 9 | + - NEW: inline SVG as base64-encoded data URL. Use new `svg.inline.embed = true` option to keep old behavior. |
28 | 10 | - Encoding of data URL: |
29 | 11 | - OLD: defaults, escaped URL (`#%` chars only), e.g. `data:image/svg+xml,<svg>...</svg>` |
30 | | - - 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. |
31 | | - |
32 | | - |
33 | | -### ✨ Feature |
34 | | - |
35 | | -New `svg` plugin option: |
36 | | - |
37 | | -```ts |
38 | | -type SvgOptions = { |
39 | | - enabled?: boolean; |
40 | | - // RegEx to match SVG files. |
41 | | - // Defaults `/\.svg/i`. |
42 | | - test?: RegExp; |
43 | | - inline?: { |
44 | | - // Enable inline SVG by replacing <img> with <svg>, only in HTML. |
45 | | - // Equivalent to query: `?inline=embed` | `?embed`. |
46 | | - // Defaults `false`. |
47 | | - embed?: boolean; |
48 | | - // Data URL encoding, overrides `generator.dataUrl.encoding` option. |
49 | | - // Equivalent to query: `?inline=base64` | `?inline=escape`. |
50 | | - // Defaults the `generator.dataUrl.encoding` option, if undefined then `base64`. |
51 | | - encoding?: 'base64' | false; |
52 | | - }; |
53 | | -}; |
54 | | -``` |
| 12 | + - NEW: |
| 13 | + - defaults, base64 encoded, e.g. `data:image/svg+xml;base64,iVBO` |
| 14 | + - full escaped URL, e.g. `data:image/svg+xml,%3Csvg%20` regards `generator.dataUrl.encoding` option. |
55 | 15 |
|
56 | | -### Bugfix |
| 16 | +### ✨ Features |
57 | 17 |
|
58 | | -Consider `generator.dataUrl()` and `generator.dataUrl.encoding` Webpack options. |
| 18 | +- Added support the `?inline` URL query to force inline an image as dataURL in HTML, JS and CSS. |
| 19 | + The encoding can be specified using a query value (`base64` or `escape`): |
| 20 | + ```html |
| 21 | + <img src="./icon.svg?inline"/> --> src as data URL regards configured encoding, defaults base64 |
| 22 | + <img src="./icon.svg?inline=base64"/> --> <img src="data:image/svg+xml;base64,PHN2Zy..."/> |
| 23 | + <img src="./icon.svg?inline=escape"/> --> <img src="data:image/svg+xml,%3Csvg%20...%2F%3E"/> |
| 24 | + ``` |
| 25 | +- Added support the `?embed` URL query to replace `<img>` with `<svg>` tag kipping img attributes: |
| 26 | + ```html |
| 27 | + <img class="icon" src="./icon.svg?embed"/> |
| 28 | + ``` |
| 29 | + Result: |
| 30 | + ```html |
| 31 | + <svg class="icon" ...>...</svg> |
| 32 | + ``` |
| 33 | +- When inlining SVG as a data URL, consider Webpack's `generator.dataUrl()` and `generator.dataUrl.encoding` options. |
| 34 | +- Display a warning when used `?embed` URL query for SVG files in JS or CSS. |
| 35 | + |
| 36 | +- New `svg` plugin option: |
| 37 | + ```ts |
| 38 | + type SvgOptions = { |
| 39 | + enabled?: boolean; |
| 40 | + // RegEx to match SVG files. |
| 41 | + // Defaults `/\.svg/i`. |
| 42 | + test?: RegExp; |
| 43 | + inline?: { |
| 44 | + // Enable inline SVG by replacing <img> with <svg>, only in HTML. |
| 45 | + // Equivalent to query: `?inline=embed` | `?embed`. |
| 46 | + // Defaults `false`. |
| 47 | + embed?: boolean; |
| 48 | + // Data URL encoding, overrides `generator.dataUrl.encoding` option. |
| 49 | + // Equivalent to query: `?inline=base64` | `?inline=escape`. |
| 50 | + // Defaults the `generator.dataUrl.encoding` option, if undefined then `base64`. |
| 51 | + encoding?: 'base64' | false; |
| 52 | + }; |
| 53 | + }; |
| 54 | + ``` |
59 | 55 |
|
60 | 56 | ## 4.18.2 release (2025-03-14) |
61 | 57 |
|
@@ -84,7 +80,7 @@ Consider `generator.dataUrl()` and `generator.dataUrl.encoding` Webpack options. |
84 | 80 |
|
85 | 81 | ## 4.18.0-beta.0 (2025-02-01) |
86 | 82 |
|
87 | | -- feat: the loader option `loaderOptions.sources` in now available directly in plugin options. |
| 83 | +- feat: the loader option `loaderOptions.sources` is now available directly in plugin options. |
88 | 84 | - feat: auto resolve source path in a.href and replaces it with output filename regards the publicPath |
89 | 85 | - feat: improve the `sources[].filter()` function, it can now return a string to modify the original value |
90 | 86 | - feat: add the `sources[].postprocess()` function, called after resolving output filenames\ |
|
0 commit comments