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

@svgr/rollup

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@svgr/rollup

SVGR Rollup plugin.

  • 8.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
214K
decreased by-23.79%
Maintainers
1
Weekly downloads
 
Created

What is @svgr/rollup?

@svgr/rollup is a Rollup plugin that transforms SVG files into React components. It allows you to import SVG files directly into your React components, making it easier to manage and use SVGs in your projects.

What are @svgr/rollup's main functionalities?

Transform SVG to React Component

This feature allows you to transform SVG files into React components using the @svgr/rollup plugin in your Rollup configuration. The code sample demonstrates how to set up the plugin in a Rollup configuration file.

import { defineConfig } from 'rollup';
import svgr from '@svgr/rollup';

export default defineConfig({
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    svgr()
  ]
});

Custom SVGR Options

This feature allows you to customize the SVGR options when transforming SVG files. The code sample shows how to enable the 'icon' option and configure SVGO to preserve the viewBox attribute.

import { defineConfig } from 'rollup';
import svgr from '@svgr/rollup';

export default defineConfig({
  input: 'src/index.js',
  output: {
    file: 'dist/bundle.js',
    format: 'cjs'
  },
  plugins: [
    svgr({
      icon: true,
      svgoConfig: {
        plugins: [{ removeViewBox: false }]
      }
    })
  ]
});

Other packages similar to @svgr/rollup

Keywords

FAQs

Package last updated on 09 May 2023

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