Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mirinzhang/svg-to-base64
A Webpack Loader to turn SVGs into Base64
https://github.com/mirinzhang/svg-to-base64
loader react turn-svgs webpack webpack-loader
Last synced: 3 days ago
JSON representation
A Webpack Loader to turn SVGs into Base64
- Host: GitHub
- URL: https://github.com/mirinzhang/svg-to-base64
- Owner: mirinzhang
- Created: 2017-03-03T05:32:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-03-10T18:07:04.000Z (over 7 years ago)
- Last Synced: 2024-04-25T12:22:32.771Z (7 months ago)
- Topics: loader, react, turn-svgs, webpack, webpack-loader
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
> A Webpack Loader to turn SVGs into Base64
## Install
```sh
npm i -D svg2base64-loader
```## Useage
```js
// without webpack loader config
import FirstImage from 'svg2base64!./firstImage.svg'; // also support .svgx file
// or let FirstImage = require('svg2base64!./firstImage.svg');// with webpack loader config
import SecondImage from './secondImage.svg';
// or let SecondImage = require('/secondImage.svg');// use in your component
```### Loader output
#### Webpack1.x
```js
// In your webpack config
{
test: /\.(svg|svgx)$/,
loader: "svg2base64"
}
```#### Webpack2.x
```js
// In your webpack config
{
test: /\.(svg|svgx)$/,
use: ["svg2base64"]
}