https://github.com/darkartur/svgson-loader
Webpack loader for converting svg+xml files to JSON.
https://github.com/darkartur/svgson-loader
svg webpack
Last synced: 4 months ago
JSON representation
Webpack loader for converting svg+xml files to JSON.
- Host: GitHub
- URL: https://github.com/darkartur/svgson-loader
- Owner: darkartur
- Created: 2017-09-14T18:06:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-12-27T10:28:16.000Z (over 8 years ago)
- Last Synced: 2025-09-29T04:14:14.466Z (9 months ago)
- Topics: svg, webpack
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SVGSON webpack loader
Converts svg+xml files to JSON. Based on [svgson](https://www.npmjs.com/package/svgson) npm package.
Can be used for rendering SVG via React components.
## Installation
```
npm install svgson-loader --save-dev
```
## Why not [svg-react-loader](https://github.com/jhamlet/svg-react-loader)?
We are writing React UI library with icon button which filling it's background color
based on [SVG 1.2](https://www.w3.org/TR/SVG12/) 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', () => (
));
```
So `Button` reads "viewport-fill" attribute inside JSON, applies backgroundColor property
then generates React.createElement calls to render SVG.