Questions tagged [svgo]
24 questions
5
votes
6 answers
Pass options to the builtin svgo from svgr/webpack
Is there an option to pass in svgo options to the svgr/webpack loader ? I want to remove the width & height attributes and keep the viewbox, by default it removes those.
{
test: /\.svg$/,
use: ['@svgr/webpack'],
options : {
svgo: {…

Twiggeh
- 1,030
- 1
- 12
- 24
4
votes
1 answer
Module not found: Error: Can't resolve '@types/svgo'
I have installed types for svgo using
yarn add @types/svgo.
In the file where I want to use svgo I write:
import SVGO from 'svgo';
From there I can comfortably inspect types by going to definition from svgo.
But when I runt yarn install or similar…

user1283776
- 19,640
- 49
- 136
- 276
4
votes
2 answers
How to activate/deactivate plugins for svgo
I have installed svgo like so:
[sudo] npm install -g svgo
Downloaded the default config from repo:
https://github.com/svg/svgo/blob/master/.svgo.yml
Edited the config like so:
...
- minifyStyles
- convertStyleToAttrs
- cleanupIDs: false
-…

Johan
- 120
- 1
- 10
3
votes
0 answers
Large SVG file with better performance than smaller ones
I'm working on an interactive solution in ReactJS that allows people to pan and zoom SVGs, but I am having problems with performance (the SVG stutters when dragged or zoomed ) because of detailed SVG. I'm using Adobe Illustrator and Inkscape to work…

Baryarte
- 63
- 1
- 6
3
votes
1 answer
How to keep ids when loading SVG with @svgr/webpack?
I am loading SVG files with @svgr/webpack into React, I works fine but it strips the ids of the elements.
In order to keep the ids, I saw the option cleanIDs in SVGO config file, which I set to false, but to no avail.
How can I keep my ids?
Here is…

Louis Coulet
- 3,663
- 1
- 21
- 39
2
votes
1 answer
How to integrate svgo into vite react project
It's a useful feature in create-react-app that I can use svg as a react component:
import { ReactComponent as NotFound } from '@/assets/images/not-found.svg'
function Error() {
return (
…

GuangWu
- 378
- 4
- 14
2
votes
3 answers
This SVGO version is no longer supported. Upgrade to v2.x.x
I am running "npx create-react-app experiment" to create a new project and I get this warning. How can I solve it? I have been researching but I get nothing
warning react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2: This SVGO version is…

Sibulele
- 324
- 1
- 3
- 12
2
votes
1 answer
SVGO config file
With svgo 1.3.2 I used to run this command :
svgo --pretty --disable={removeUnusedNS,removeUselessDefs,removeUselessStrokeAndFill} file.svg -o file.min.svg
I updated to svgo 2.3.0 and now I get :
error: unknown option…

jpprade
- 3,497
- 3
- 45
- 58
2
votes
1 answer
Interpreting compressed SVG path command syntax
I'm working with compressed SVG path data which has been output from SVGO, and I can't understand one part of a relative line-to command. The path itself looks like this (it's a triangle, and it displays correctly):

Ben Hull
- 7,524
- 3
- 36
- 56
1
vote
2 answers
npx create-react-app projectName fails to create project
I am creating a react project using npx create-react-app experiment
and I have been getting the below error, can anybody help with how to resolve it.
NB, I have uninstalled global installations of create-react-app
(base) sibulele@sibulele-X555LAB:~$…

Sibulele
- 324
- 1
- 3
- 12
1
vote
2 answers
Unable to configure svgo-loader (webpack)
I'm using svgo-loader to optimize the svg images and its using the default configuration for this. I want to add some custom configuration like I dont want to remove the viewBox from svg as it makes defining the dimensions of svg really hard.
I…

Mukul Kumar Jha
- 1,062
- 7
- 19
1
vote
1 answer
SVGR (SVGO) removeAttrs does not remove specified fill atrribute
Fill attribute does not get removed in final output even though removeAttrs is specified in .svgo.yml. This causes the issue when trying to update fill from props passed to generated component like so:
When I manually remove…

Jakša Mališić
- 345
- 7
- 13
1
vote
1 answer
svgo shape to path do not convert ellipses
Trying to use svgo to batch convert shapes to paths from svg files.
https://github.com/svg/svgo
svgo --version
1.2.0
looklike ellipse element are not converted to paths
made test on commande line like :
➜ svg svgo --enable=convertShapeToPath…

direxit
- 367
- 3
- 18
1
vote
2 answers
Why does svgo remove everything when minimizing an svg with symbols?
Looking at svg minimization options, I found svgo https://github.com/svg/svgo
. I successfully tried it with svg generated from illustrator, however, when I run it against the following, the resulting file is completely blank.
1
vote
1 answer
SVGO - Add Plugin
This might be a silly question...
I've installed SVGO from https://github.com/svg/svgo
I want to turn on the plug-ing that does this:
apply transforms, crop by real width, center vertical alignment and
resize SVG with one Path inside (disabled…

Aaron Benjamin
- 1,291
- 3
- 18
- 27