🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

postcss-svgo

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
c

postcss-svgo

Optimise inline SVG with PostCSS.

7.0.2
latest
100

Supply Chain Security

100

Vulnerability

100

Quality

89

Maintenance

100

License

Version published
Weekly downloads
12M
5.92%
Maintainers
7
Weekly downloads
 
Created
Issues
99

What is postcss-svgo?

The postcss-svgo package is a plugin for PostCSS that optimizes SVG vector graphics within CSS. It uses SVGO (SVG Optimizer) under the hood to compress SVG images by removing unnecessary data without affecting the rendering of the SVG. This results in smaller file sizes and potentially faster load times for web pages that use SVG images in their stylesheets.

What are postcss-svgo's main functionalities?

Optimize inline SVG with PostCSS

This code sample demonstrates how to use postcss-svgo to optimize inline SVG within CSS. It sets up PostCSS with the postcss-svgo plugin, specifying a configuration object that includes SVGO plugins like 'removeDoctype' to strip out the doctype declaration from SVGs.

"use strict";\nconst postcss = require('postcss');\nconst postcssSvgo = require('postcss-svgo');\n\npostcss()\n  .use(postcssSvgo({\n    plugins: [{\n      removeDoctype: true\n    }]\n  }))\n  .process('a { background: url('data:image/svg+xml;charset=utf-8,<svg>...</svg>'); }')\n  .then(result => {\n    console.log(result.css);\n  });

Other packages similar to postcss-svgo

FAQs

Package last updated on 06 May 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts