Skip to content

joycollector/rollup-plugin-svelte-svg

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rollup-plugin-svelte-svg

Import SVG files as Svelte Components

Installation

npm i -D rollup-plugin-svelte-svg

Usage

Svelte

// rollup.config.js
import svelteSVG from "rollup-plugin-svelte-svg";

export default {
	entry: "src/input.js",
	dest: "dist/output.js",
	plugins: [
		svelteSVG(),
	],
}

Sapper

// rollup.config.js
import svelteSVG from "rollup-plugin-svelte-svg";

export default {
    client: {
        plugins: [
            svelteSVG({ dev }),            
        ],
        ...
    },
    server: {
        plugins: [
            svelteSVG({ generate: "ssr", dev }),
        ],
        ...
    }
}

You can then use svgs in your bundle thusly:

<script>
	import logo from "./logo.svg";
</script>

<logo width="20" />

Sources

This plugin was forked from @antony/rollup-plugin-svg to import SVGs as Svelte components.

License

MIT

About

Import SVG files as Svelte Components

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%