Skip to content

A webpack loader to load svg files as preact components.

License

Notifications You must be signed in to change notification settings

VuexLtd/preact-svg-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

rules: [
    {
        test: /\.svg$/,
        use: ['preact-svg-loader'],
    }
]

In your code, simply require the svg as if it were a component.

import Logo from './logo.svg';

() => <Logo />