salt-svg-loader

1.2.0 • Public • Published

SVG to React Loader

A Webpack Loader to convert SVG into React Component

Feature

  • SVG optimazation using SVGO, default config see here
  • transform svg slug attr name (like fill-opacity) to camel case (like fillOpacity)
  • generate shadow mask covering svg to optimize svg icon clicking experience

Installation

tnpm install salt-svg-loader

Usage

var React = require('react');
var Icon = require('babel!salt-svg!./my-icon.svg?name=Icon');
 
module.exports = React.createClass({
    render () {
        return <Icon className='normal' />;
    }
});

Fork svg2react-loader, and has been reconstructed and optimized.

Package Sidebar

Install

npm i salt-svg-loader

Weekly Downloads

1

Version

1.2.0

License

ISC

Last publish

Collaborators

  • taoqili
  • eternalsky
  • 2999
  • ex90rts