2.0.0 • Published 6 years ago

svgson-loader v2.0.0

Weekly downloads
94
License
ISC
Repository
github
Last release
6 years ago

SVGSON webpack loader

Converts svg+xml files to JSON. Based on svgson npm package. Can be used for rendering SVG via React components.

Installation

npm install svgson-loader --save-dev

Why not svg-react-loader?

We are writing React UI library with icon button which filling it's background color based on SVG 1.2 property "viewport-fill":

import vkIcon from 'svgson-loader!./icons/vk.svg';
import okIcon from 'svgson-loader!./icons/ok.svg';
import fbIcon from 'svgson-loader!./icons/fb.svg';

stories.add('Social buttons', () => (
	<div>
		<Button icon={vkIcon} />
		<Button icon={okIcon} />
		<Button icon={fbIcon} />
	</div>
));

So Button reads "viewport-fill" attribute inside JSON, applies backgroundColor property then generates React.createElement calls to render SVG.

2.0.0

6 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago