Skip to content

Adamwu1992/svga-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svga-loader

A loader for webpack to load svga file. You can parse it at compile-time.

Usage

npm i -D svga-loader

wewbpack.config.js

module.exports = {
  // ...
  module: {
    rules: [
      // ...
      {
        test: /\.svga$/,
        use: 'svga-loader'
      }
    ]
  },
  // ...
}

example

before

import { Player, Parser } from 'svgaplayerweb'

const parser = new Parser('#app')
const player = new Player("#app")

parser.load('ReadyGo.svga', function(videoItem) {
    player.setVideoItem(videoItem);
    player.startAnimation();
})

player.setVideoItem(ReadyGo)
player.startAnimation()

with svga-loader

import { Player } from 'svgaplayerweb'
import ReadyGo from './assets/ReadyGo.svga'

const player = new Player("#app")

player.setVideoItem(ReadyGo)
player.startAnimation()

About

A loader for webpack to load svga file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published