1
0
mirror of https://github.com/svg/svgo.git synced 2026-01-27 07:02:06 +03:00
Files
svgo/docs/03-plugins/remove-viewbox.mdx
2023-11-07 23:43:09 +00:00

31 lines
928 B
Plaintext

---
title: Remove ViewBox
svgo:
pluginId: removeViewBox
defaultPlugin: true
---
Removes the [`viewBox`](https://developer.mozilla.org/docs/Web/SVG/Attribute/viewBox) attribute where it matches the documents width and height.
:::danger
This plugin prevents SVGs from scaling, so they will not fill their parent container, or may clip if the container is too small.
Some external tools that use SVGO have also been found to override the default preset to disable this plugin by default, including [Docusaurus](https://github.com/facebook/docusaurus/blob/e17784effa2c370d81c7806c22ad19c6dce4a1cc/packages/docusaurus-utils/src/webpackUtils.ts#L127) and [SVGR](https://react-svgr.com/docs/migrate/#svgo).
See [svg/svgo#1128](https://github.com/svg/svgo/issues/1128) for more context.
:::
## Usage
<PluginUsage/>
## Demo
<PluginDemo/>
## Implementation
* https://github.com/svg/svgo/blob/main/plugins/removeViewBox.js