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

babel-plugin-inline-react-svg

Package Overview
Dependencies
Maintainers
6
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-inline-react-svg

A babel plugin that optimizes and inlines SVGs for your react components.

  • 2.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
128K
increased by7.41%
Maintainers
6
Weekly downloads
 
Created

What is babel-plugin-inline-react-svg?

The babel-plugin-inline-react-svg package is a Babel plugin that allows you to import SVG files directly as React components. This can be particularly useful for including SVGs in your React applications without having to manually convert them to JSX.

What are babel-plugin-inline-react-svg's main functionalities?

Importing SVG as React Component

This feature allows you to import an SVG file and use it as a React component. The SVG content is inlined into the component, which can then be used like any other React component.

import Logo from './logo.svg';

const App = () => (
  <div>
    <Logo />
  </div>
);

Customizing SVG Attributes

You can customize the attributes of the imported SVG component, such as width, height, and fill color, directly in your JSX.

import Logo from './logo.svg';

const App = () => (
  <div>
    <Logo width="100" height="100" fill="red" />
  </div>
);

Inlining SVGs for Performance

Inlining SVGs can improve performance by reducing the number of HTTP requests and allowing for better control over the SVG content.

import Icon from './icon.svg';

const App = () => (
  <div>
    <Icon />
  </div>
);

Other packages similar to babel-plugin-inline-react-svg

Keywords

FAQs

Package last updated on 23 Feb 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