rollup-plugin-svelte-svg

Rollup Plugin Svelte Svg

Rollup plugin to transform SVGs into Svelte components.

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

Top categories

svelte logo

Want a Svelte site built?

Hire a Svelte developer
Loading Svelte Themes