Gathering detailed insights and metrics for rollup-plugin-svelte-svg
Gathering detailed insights and metrics for rollup-plugin-svelte-svg
Gathering detailed insights and metrics for rollup-plugin-svelte-svg
Gathering detailed insights and metrics for rollup-plugin-svelte-svg
npm install rollup-plugin-svelte-svg
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
76 Stars
57 Commits
12 Forks
3 Watching
2 Branches
5 Contributors
Updated on 07 Sept 2024
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
2.9%
251
Compared to previous day
Last week
10.7%
1,316
Compared to previous week
Last month
8%
6,122
Compared to previous month
Last year
-41.7%
81,408
Compared to previous year
2
1
Import SVG files as Svelte Components
Note:
rollup-plugin-svelte-svg
was rewritten from scratch recently, and no longer exposes Svelte options({ dev, generate })
since we now delegate compilation to the Svelte plugin that's loaded after us. You should remove these options since they have no effect.This is a nonbreaking change for most users, however if you do face a problem, raise an issue.
1# using npm 2npm i -D rollup-plugin-svelte-svg 3 4# using yarn 5yarn add -D rollup-plugin-svelte-svg 6 7# using pnpm 8pnpm i -D rollup-plugin-svelte-svg
Simply call svelteSVG
before svelte
in your rollup config.
1// rollup.config.js 2import { svelteSVG } from "rollup-plugin-svelte-svg"; 3 4export default { 5 entry: "src/input.js", 6 dest: "dist/output.js", 7 plugins: [ 8 svelteSVG({ 9 // optional SVGO options 10 // pass empty object to enable defaults 11 svgo: {} 12 }), 13 ], 14 ... 15}
1// rollup.config.js 2import { svelteSVG } from "rollup-plugin-svelte-svg"; 3 4export default { 5 client: { 6 plugins: [ 7 svelteSVG({ 8 // optional SVGO options 9 // pass empty object to enable defaults 10 svgo: {}, 11 }), 12 ], 13 ... 14 }, 15 server: { 16 plugins: [ 17 svelteSVG({ 18 // optional SVGO options 19 // pass empty object to enable defaults 20 svgo: {} 21 }), 22 ], 23 ... 24 }, 25}
1// vite.config.js
2import { defineConfig } from "vite";
3import { svelteSVG } from "rollup-plugin-svelte-svg";
4
5export default defineConfig({
6 ...
7 plugins: [
8 svelteSVG({
9 // optional SVGO options
10 // pass empty object to enable defaults
11 svgo: {},
12 // vite-specific
13 // https://vitejs.dev/guide/api-plugin.html#plugin-ordering
14 // enforce: 'pre' | 'post'
15 enforce: "pre",
16 }),
17 ...
18 ],
19});
You can then import svg in your JS thusly:
1<script> 2 import Logo from "./logo.svg"; 3</script> 4 5<Logo width=20 />
This plugin was originally forked from antony/rollup-plugin-svg, but has been rewritten since.
@featherbear's fork and metafy-gg's fork inspired svgo optimisation and vite support.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
1 existing vulnerabilities detected
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More