0.3.2 • Published 2 years ago

svg-component-vite-plugin v0.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

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

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago