Gathering detailed insights and metrics for vue-cli-plugin-svg
Gathering detailed insights and metrics for vue-cli-plugin-svg
Gathering detailed insights and metrics for vue-cli-plugin-svg
Gathering detailed insights and metrics for vue-cli-plugin-svg
npm install vue-cli-plugin-svg
Typescript
Module System
Node Version
NPM Version
34.1
Supply Chain
48.5
Quality
63.9
Maintenance
25
Vulnerability
95.1
License
JavaScript (100%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
500,767
Last Day
158
Last Week
677
Last Month
2,983
Last Year
40,078
MIT License
29 Stars
26 Commits
9 Forks
2 Watchers
6 Branches
2 Contributors
Updated on Nov 21, 2024
Minified
Minified + Gzipped
Latest Version
0.2.1
Package Id
vue-cli-plugin-svg@0.2.1
Unpacked Size
9.19 kB
Size
3.93 kB
File Count
6
NPM Version
6.14.13
Node Version
14.17.1
Cumulative downloads
Total Downloads
Last Day
29.5%
158
Compared to previous day
Last Week
-1.7%
677
Compared to previous week
Last Month
32.3%
2,983
Compared to previous month
Last Year
-51.1%
40,078
Compared to previous year
1
Super simple svg loading module for Vue.js
(actual npm package is vue-cli-plugin-svg)
vue-svg
allows you to import .svg
files in multiple ways depending on the resource query you provide. Currently, this allows you to do the following:
file.svg
- normal import using file-loader
file.svg?data
- base64 data url import using url-loader
file.svg?inline
- inline import using vue-svg-loader
file.svg?sprite
- import using svg-sprite-loader
(alpha implementation)Using the new Vue CLI 3, it's as simple as navigating to your project and running:
1$ vue add svg
That's it! You're ready to go!
The usage examples are documented as:
1<!-- Vue.js code -->
1<!-- Outputted html -->
Import normally as an external resource using file-loader
1<template> 2 <img src="@/assets/vue-logo.svg" /> 3</template>
1<img src="/img/vue-logo.938241fe.svg" />
Inline as a URL (no external requests) using url-loader
1<template> 2 <img src="@/assets/vue-logo.svg?data" /> 3</template>
1<img src="data:image/svg+xml;base64,P...2h913j1g18h98hr" />
Inline as an actual svg element using vue-svg-loader
1<template> 2 <VueLogo /> 3</template> 4 5<script> 6 import VueLogo from "@/assets/vue-logo.svg?inline"; 7 8 export default { 9 components: { 10 VueLogo 11 } 12 }; 13</script>
1<svg xmlns="http://www.w3.org/2000/svg"><path></path></svg>
1<template> 2 <svg><use xlink:href="#vue-logo"></use></svg> 3</template> 4 5<script> 6 import "@/assets/vue-logo.svg?sprite"; 7</script>
1<!-- Coming shortly -->
You can provide options to all of the loaders used in using the vue.config.js
pluginOptions
field:
1// vue.config.js 2 3module.exports = { 4 pluginOptions: { 5 svg: { 6 inline: {}, // Pass options to vue-svg-loader 7 data: {}, // Pass options to url-loader 8 sprite: {}, // Pass options to svg-sprite-loader 9 external: {} // Pass options to file-loader 10 } 11 } 12};
You can provide as many options as you like, or nothing at all. You don't have to configure options, it will use some standard defaults.
You can also customise the resource queries for each type that doesn't get passed as a loader options (other than external
, which doesn't use a resourceQuery):
1// vue.config.js 2 3module.exports = { 4 pluginOptions: { 5 svg: { 6 // You can change this 7 inline: { resourceQuery: /inline/ } 8 } 9 } 10};
By default, file-loader
will inherit the standard configuration from vue-cli
so that behaves exactly the same.
vue-svg-loader
by default will not use svgo
. This is because it can cause more problems than it solves generally, though this can be easily re-enabled. Check the vue-svg-loader
documentation for more info.
As this loader attempts to abstract webpack configuration from the process and make it easier to use multiple svg loaders, any contributions that add more svg loader methods to the configuration will be accepted wholeheartedly!
Also I'll be actively maintaining this project so if you'd rather just make a request for a loader or a feature; I'd be happy to take a look and see what I can do myself :)
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
project is archived
Details
Reason
Found 1/24 approved changesets -- 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
Reason
18 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-03
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