Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/vuexltd/preact-svg-loader

A webpack loader to load svg files as preact components.
https://github.com/vuexltd/preact-svg-loader

preact svg webpack webpack-loader

Last synced: 3 months ago
JSON representation

A webpack loader to load svg files as preact components.

Awesome Lists containing this project

README

        

# preact-svg-loader
Load svg files as preact components.

## Install
```
npm i --save-dev preact-svg-loader
// or
yarn add --dev preact-svg-loader
```

## Usage

Add the loader to your webpack config.
```js
rules: [
{
test: /\.svg$/,
use: ['preact-svg-loader'],
}
]
```

In your code, simply require the svg as if it were a component.
```jsx
import Logo from './logo.svg';

() =>
```