@constgen/neutrino-svgr-loader

1.10.0 • Public • Published

@constgen/neutrino-svgr-loader

npm npm

Neutrino middleware for SVG components. You will be able to use SVGs as React components using named imports

import logoImage, { ReactComponent as Logo } from './logo.svg'

export default function () {
   return (
      <>
         This is the logo component
         <Logo width="200" height="50" title="Title text" className="logo" />

         This is the logo image
         <img src={logoImage} width="200" height="50" alt="Title text" className="logo" />
      </>
   )
}

Features

  • exports React components from SVG modules as named exports

Requirements

  • Node.js v10+
  • Neutrino v9
  • Webpack v4

Installation

@constgen/neutrino-svgr-loader can be installed from NPM. You should install it to "dependencies" (--save) or "devDependncies" (--save-dev) depending on your goal.

npm install --save @constgen/neutrino-svgr-loader

Usage

In preset

Require this package and plug it into Neutrino. The middleware has no options:

let svgrLoader = require('@constgen/neutrino-svgr-loader')

neutrino.use(svgrLoader())

In neutrinorc

The middleware also may be used together with another presets in Neutrino rc-file, e.g.:

.neutrinorc.js

let svgrLoader = require('@constgen/neutrino-svgr-loader')

module.exports = {
   use: [
      svgrLoader()
   ]
}

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.10.0
    57
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.10.0
    57

Package Sidebar

Install

npm i @constgen/neutrino-svgr-loader

Weekly Downloads

0

Version

1.10.0

License

GPL-3.0

Unpacked Size

39.2 kB

Total Files

4

Last publish

Collaborators

  • constgen