html-bundler-webpack-plugin
Advanced tools
Changelog
4.19.0
<img src="icon.svg">
:
<img>
with <svg>
tagsvg.inline.embed = true
option to keep old behavior.#%
chars only), e.g. data:image/svg+xml,<svg>...</svg>
data:image/svg+xml;base64,iVBO
data:image/svg+xml,%3Csvg%20
regards generator.dataUrl.encoding
option.Added support the ?inline
URL query to force inline an image as dataURL in HTML, JS and CSS.
The encoding can be specified using a query value (base64
or escape
):
<img src="./icon.svg?inline"/> --> src as data URL regards configured encoding, defaults base64
<img src="./icon.svg?inline=base64"/> --> <img src="data:image/svg+xml;base64,PHN2Zy..."/>
<img src="./icon.svg?inline=escape"/> --> <img src="data:image/svg+xml,%3Csvg%20...%2F%3E"/>
Added support the ?embed
URL query to replace <img>
with <svg>
tag kipping img attributes:
<img class="icon" src="./icon.svg?embed"/>
Result:
<svg class="icon" ...>...</svg>
When inlining SVG as a data URL, consider Webpack's generator.dataUrl()
and generator.dataUrl.encoding
options.
Display a warning when used ?embed
URL query for SVG files in JS or CSS.
New svg
plugin option:
type SvgOptions = {
enabled?: boolean;
// RegEx to match SVG files.
// Defaults `/\.svg/i`.
test?: RegExp;
inline?: {
// Enable inline SVG by replacing <img> with <svg>, only in HTML.
// Equivalent to query: `?inline=embed` | `?embed`.
// Defaults `false`.
embed?: boolean;
// Data URL encoding, overrides `generator.dataUrl.encoding` option.
// Equivalent to query: `?inline=base64` | `?inline=escape`.
// Defaults the `generator.dataUrl.encoding` option, if undefined then `base64`.
encoding?: 'base64' | false;
};
};
Changelog
4.18.2 release (2025-03-14)
Changelog
4.18.1 release (2025-03-13)