Skip to content

Commit ef7fbf5

Browse files
committed
release v4.19.0
1 parent 1e271a9 commit ef7fbf5

5 files changed

Lines changed: 1201 additions & 1632 deletions

File tree

CHANGELOG.md

Lines changed: 44 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,57 @@
11
# Changelog
22

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
224

235
### 🔥 BREAKING CHANGES by inlining SVG only
246

257
- Inline `<img src="icon.svg">`:
268
- 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.
2810
- Encoding of data URL:
2911
- 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.
5515

56-
### Bugfix
16+
### ✨ Features
5717

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+
```
5955

6056
## 4.18.2 release (2025-03-14)
6157

@@ -84,7 +80,7 @@ Consider `generator.dataUrl()` and `generator.dataUrl.encoding` Webpack options.
8480

8581
## 4.18.0-beta.0 (2025-02-01)
8682

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.
8884
- feat: auto resolve source path in a.href and replaces it with output filename regards the publicPath
8985
- feat: improve the `sources[].filter()` function, it can now return a string to modify the original value
9086
- feat: add the `sources[].postprocess()` function, called after resolving output filenames\

0 commit comments

Comments
 (0)