Skip to content
This repository has been archived by the owner on Apr 27, 2023. It is now read-only.

hyrious/vite-plugin-svga

Repository files navigation

vite-plugin-svga

A vite plugin to load svga file. Based on svga-loader.

Todo

⚠️ I personally not use this library. PRs are welcome to implement things below:

  • copy code from svga-loader
  • refactor transformload
  • why do we need to parse VideoEntity by hand? can we use svga itself?
  • vite-plugin-svga.lite

Usage

npm i -D @hyrious/vite-plugin-svga

vite.config.ts

import svga from "@hyrious/vite-plugin-svga";

export default {
  plugins: [svga()],
};

main.ts

import { Player } from "svgaplayerweb";
import PinJump from "./assets/PinJump.svga";

const player = new Player("#app");

player.setVideoItem(PinJump);
player.startAnimation();

Recommend: shim.d.ts

declare module "*.svga" {
  const content: import("svgaplayerweb").VideoEntity;
  export default content;
}

License

MIT @ hyrious