3.0.1 • Published 6 years ago

jacobmarshall-react-inline-svg v3.0.1

Weekly downloads
179
License
MIT
Repository
-
Last release
6 years ago

jacobmarshall-react-inline-svg

React Component to load and inline SVG images, allowing you to target and style SVGs using CSS.

Features

  • Easy to use, just add InlineSVG components
  • Loads SVGs automatically using a XMLHttpRequest
  • Loads each SVG exactly once, and caches them for repeated use
  • Can preload SVGs in advance using InlineSVG.cache

Installation

$ npm i --save jacobmarshall-react-inline-svg

Usage

Include the component:

<script src="https://unpkg.com/jacobmarshall-react-inline-svg@2.0/dist/react-inline-svg.js"></script>

Or...

import InlineSVG from 'jacobmarshall-react-inline-svg';

Render an inline SVG:

<InlineSVG src="/path/to/your.svg" className="css-class" />

Pre-loading SVGs

InlineSVG.cache.load("/path/to/your.svg");

Building from Source

To re-build this after making changes in src, simply run:

$ gulp
3.0.1

6 years ago

3.0.0

6 years ago

2.0.3

7 years ago

2.0.2

7 years ago

2.0.1

8 years ago

2.0.0

8 years ago