Rollup plugin to transform SVGs into Svelte components.
It also optimizes your SVGs by running them thru svgo.
This package is not published to NPM at this point in time.
<script>
import MyIcon from 'assets/my-icon.svg';
</script>
<MyIcon width={42} height={42} />
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 });
]
}
}
This plugin is based on the work from the following projects:
MIT