1.0.3 • Published 2 years ago

rollup-plugin-preact-svg-lite v1.0.3

Weekly downloads
123
License
MIT
Repository
github
Last release
2 years ago

rollup-plugin-preact-svg-lite

Import SVG files in preact.

Purpose

This is a Rollup plugin for importing SVG files in Preact.

It can work with rollup 2.x.x and @rollup/plugin-typescript 6.x.x.

Installation

npm install rollup-plugin-preact-svg-lite -D

Usage

// rollup.config.js

import svg from 'rollup-plugin-preact-svg-lite';

export default {
  // ...
  plugins: [
    svg()
  ]
}

Example

// main.ts
import {h, FunctionalComponent} from 'preact';
import Logo from 'path/to/logo.svg';

export const App: FunctionalComponent = () => (
  <Logo />
);
// rollup.config.js
import typescript from "@rollup/plugin-typescript";
import svg from 'rollup-plugin-preact-svg-lite';

export default {
  // ...
  plugins: [
    typescript(),
    svg(),
  ]
}