0.3.2 • Published 1 year ago
svg-component-vite-plugin v0.3.2
vite svg component plugin
how to use
npm i -D svg-component-vite-plugin
or
yarn add -D svg-component-vite-plugin
react
// vite.config.js
import { viteReactSvgComponentPlugin } from 'svg-component-vite-plugin/dist/react';
plugins: [
...,
viteReactSvgComponentPlugin({
include: './assets/svgs/*.svg', //svg icon dir
})
],
example
import IconTwitter, { svgCode, uri } from './assets/svgs/twitter.svg';
export default function App() {
return (
<div>
<IconTwitter
size="8"
replacePropsByFill={{
"#FDA085": {
fill: 'yellow',
fillOpacity: 1
}
}} />
<p>uri: {uri}</p>
<p>svgCode: {svgCode}</p>
</div>
)
}
Code suggestion
// Add the following line of code to any .d.ts file that is included in tsconfig.json.
// For example, in the src/svg-component.d.ts file.
import 'svg-component-vite-plugin/dist/react/react-svg-component';
vue coming soon.
0.3.2
1 year ago
0.3.1
1 year ago
0.3.0
1 year ago
0.2.9
1 year ago
0.2.8
1 year ago
0.2.7
1 year ago
0.2.6
1 year ago
0.2.5
1 year ago
0.2.4
1 year ago
0.2.3
1 year ago
0.2.2
1 year ago
0.2.1
1 year ago
0.2.0
1 year ago
0.1.10
1 year ago
0.1.9
1 year ago
0.1.8
1 year ago
0.1.6
1 year ago
0.1.5
1 year ago
0.1.4
1 year ago
0.1.3
1 year ago
0.1.2
1 year ago
0.1.1
1 year ago
0.1.0
1 year ago