react-svg-inline-loader

0.2.2 • Public • Published

react-svg-inline-loader

Finds all svg files require'd in as a React Component and inlines them.

It should work with both the server-side rendering and on the browser.

Usage (in your webpack.config.js)

module: {
	loaders: [{
		test: /\.svg$/,
		exclude: /(node_modules)/,
		loaders: ['react-svg-inline-loader']
	}]
}

Usage in your react components

var React = require('react')
var SvgPicture = require('./picture.svg')

class TestComponent extends React.Component {
	constructor(props, context) {
		super(props, context)
	}

	render() {
		return <SvgPicture className="big red icon"/>
	}
}

Requirements

node (version 4 or higher)

Installation

npm install react-svg-inline-loader --save

Tests

mocha

Dependencies

Nothing external

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.2
    290
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.2
    290
  • 0.2.1
    0
  • 0.2.0
    1
  • 0.1.0
    0

Package Sidebar

Install

npm i react-svg-inline-loader

Weekly Downloads

291

Version

0.2.2

License

WTFPL

Last publish

Collaborators

  • nightwolfz