Socket
Socket
Sign inDemoInstall

@elliottsj/next-svgr

Package Overview
Dependencies
314
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @elliottsj/next-svgr

Plugin for NextJS to use SVG with svgr.


Version published
Maintainers
1
Install size
25.2 MB
Created

Readme

Source

:rocket: next-svgr

License npm package Dependencies DevDependencies

Plugin for Next to automatically be able to transform svg files into components using the excellent svgr library.

Table of contents

Installation

npm install --save next-svgr

Or using yarn:

yarn add next-svgr

Then, import the library in your next.config.js file.

// next.config.js
const withSvgr = require("next-svgr");

module.exports = withSvgr({
  // your config for other plugins or the general next.js here...
});

Or you can use it with next-compose-plugins for a cleaner configuration.

// next.config.js
const withPlugins = require("next-compose-plugins");
const withSvgr = require("next-svgr");

module.exports = withPlugins([
  withSvgr
  // your other plugins here
]);

Usage

You can now start importing your SVG files as if they were components:

import MyIcon from "./myicon.svg";

export default () => (
  <div>
    <MyIcon />
  </div>
);

Please check the documentation of svgr for more examples.

FAQs

Last updated on 06 Oct 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc