Socket
Socket
Sign inDemoInstall

imagemin-svgo

Package Overview
Dependencies
Maintainers
2
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagemin-svgo

svgo imagemin plugin


Version published
Maintainers
2
Created

What is imagemin-svgo?

The imagemin-svgo npm package is a plugin for Imagemin that uses SVGO (SVG Optimizer) to compress and optimize SVG files. It helps reduce the file size of SVG images by removing unnecessary data without affecting the visual quality.

What are imagemin-svgo's main functionalities?

Basic SVG Optimization

This code demonstrates how to use imagemin-svgo to optimize SVG files in the 'images' directory and save the optimized files to the 'output/images' directory.

const imagemin = require('imagemin');
const imageminSvgo = require('imagemin-svgo');

(async () => {
    await imagemin(['images/*.svg'], {
        destination: 'output/images',
        plugins: [
            imageminSvgo()
        ]
    });
    console.log('SVG images optimized');
})();

Custom SVGO Options

This code shows how to use imagemin-svgo with custom SVGO options. In this example, the 'removeViewBox' and 'cleanupIDs' plugins are configured to preserve the viewBox attribute and IDs in the SVG files.

const imagemin = require('imagemin');
const imageminSvgo = require('imagemin-svgo');

(async () => {
    await imagemin(['images/*.svg'], {
        destination: 'output/images',
        plugins: [
            imageminSvgo({
                plugins: [
                    { removeViewBox: false },
                    { cleanupIDs: false }
                ]
            })
        ]
    });
    console.log('SVG images optimized with custom options');
})();

Other packages similar to imagemin-svgo

Keywords

FAQs

Package last updated on 06 Nov 2014

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