Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-svgo

Package Overview
Dependencies
Maintainers
7
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-svgo

Optimise inline SVG with PostCSS.

  • 5.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
10M
decreased by-7.66%
Maintainers
7
Weekly downloads
 
Created

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

Keywords

FAQs

Package last updated on 01 Mar 2022

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc