Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Latest commit

 

History

History
56 lines (40 loc) · 930 Bytes

README.md

File metadata and controls

56 lines (40 loc) · 930 Bytes

Rollup Svelte SVG

Rollup plugin to transform SVGs into Svelte components.

It also optimizes your SVGs by running them thru svgo.

Note

This package is not published to NPM at this point in time.

Usage

<script>
  import MyIcon from 'assets/my-icon.svg';
</script>

<MyIcon width={42} height={42} />

Setup

rollup.config.js

const svelteSVG = require("rollup-plugin-svelte-svg");

// Sapper
export default {
  client: {
    // ...
    plugins: [
      svelteSVG({ svgoConfig: {}, ssr: false });
    ]
  },
  server: {
    // ...
    plugins: [
      svelteSVG({ svgoConfig: {}, ssr: true });
    ]
  }
}

Credits

This plugin is based on the work from the following projects:

License

MIT