Gathering detailed insights and metrics for vue-svg-inline-loader-corejs3
Gathering detailed insights and metrics for vue-svg-inline-loader-corejs3
npm install vue-svg-inline-loader-corejs3
Typescript
Module System
Node Version
NPM Version
57.1
Supply Chain
95.3
Quality
72.6
Maintenance
50
Vulnerability
99.3
License
JavaScript (100%)
Total Downloads
20,248
Last Day
1
Last Week
6
Last Month
13
Last Year
117
169 Commits
1 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.5.0
Package Id
vue-svg-inline-loader-corejs3@1.5.0
Unpacked Size
41.96 kB
Size
12.48 kB
File Count
8
NPM Version
6.14.4
Node Version
14.0.0
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
100%
6
Compared to previous week
Last month
62.5%
13
Compared to previous month
Last year
-17.6%
117
Compared to previous year
Webpack loader used for inline replacement of SVG images with actual content of SVG files in Vue projects.
Loader parses only HTML template format.
Loader has built-in SVGO support for SVG optimization.
Sprite option works only with Vue Single File Component approach.
true
value as alias for default configurationnull
or false
value for disabling SVG optimization1$ npm install vue-svg-inline-loader --save-dev
1$ yarn add vue-svg-inline-loader --dev
With webpack - webpack.config.js (recommended):
1// webpack 2 3module.exports = { 4 module: { 5 rules: [ 6 { 7 test: /\.vue$/, 8 use: [ 9 { 10 loader: "vue-loader", 11 options: { /* ... */ } 12 }, 13 { 14 loader: "vue-svg-inline-loader", 15 options: { /* ... */ } 16 } 17 ] 18 } 19 ] 20 } 21};
With vue-cli - vue.config.js:
With gridsome - gridsome.config.js:
With quasar - quasar.conf.js:
1// vue-cli, gridsome, quasar 2 3module.exports = { 4 chainWebpack: config => { 5 config.module 6 .rule("vue") 7 .use("vue-svg-inline-loader") 8 .loader("vue-svg-inline-loader") 9 .options({ /* ... */ }); 10 } 11};
With nuxt - nuxt.config.js:
With quasar - quasar.conf.js:
1// nuxt, quasar 2 3module.exports = { 4 build: { 5 // use extend() method for nuxt 6 // use extendWebpack() method for quasar 7 extendWebpack(config, { isServer, isClient }) { 8 config.module.rules.push({ 9 test: /\.vue$/, 10 loader: "vue-svg-inline-loader", 11 options: { /* ... */ } 12 }) 13 } 14 } 15};
With laravel-mix - webpack.mix.js:
1// laravel-mix 2 3const mix = require("laravel-mix"); 4 5mix.override(config => { 6 config.module.rules.push({ 7 test: /\.vue$/, 8 use: [{ 9 loader: "vue-svg-inline-loader", 10 options: { /* ... */ } 11 }] 12 }) 13});
Basic inline SVG usage with svg-inline
keyword directive:
1<img svg-inline class="icon" src="./images/example.svg" alt="example" />
Which replaces into:
1<svg svg-inline class="icon" focusable="false" role="presentation" tabindex="-1" xmlns="http://www.w3.org/2000/svg" viewBox="..."> 2 <path d="..."></path> 3</svg>
Basic inline SVG sprite usage with svg-sprite
keyword directive:
1<img svg-inline svg-sprite class="icon" src="./images/example.svg" alt="example" />
Which replaces into:
1<svg svg-inline svg-sprite class="icon" focusable="false" role="presentation" tabindex="-1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> 2 <use xlink:href="#svg-sprite-md5hash" href="#svg-sprite-md5hash"></use> 3</svg> 4<!-- ... --> 5<!-- will get injected right before root closing tag in Vue component --> 6<svg xmlns="http://www.w3.org/2000/svg" style="display: none !important;"> 7 <symbol id="svg-sprite-md5hash" xmlns="http://www.w3.org/2000/svg" viewBox="..."> 8 <path d="..."></path> 9 </symbol> 10 <!-- ... --> 11</svg>
Loader won't parse any images with Vue bindings used as src
attribute [more info].
If you need to preserve image tag (e.g. in comments), you can wrap it in hash (#
) or triple backtick (```
) characters.
Default options:
1{ 2 inline: { 3 keyword: "svg-inline", 4 strict: true 5 }, 6 sprite: { 7 keyword: "svg-sprite", 8 strict: true 9 }, 10 addTitle: false, 11 addAttributes: { 12 role: "presentation", 13 focusable: false, 14 tabindex: -1 15 }, 16 dataAttributes: [], 17 removeAttributes: ["alt", "src"], 18 transformImageAttributesToVueDirectives: true, 19 md5: true, 20 xhtml: false, 21 svgo: true, 22/* value true for svgo option is alias for: 23 svgo: { 24 plugins: [ 25 { 26 removeViewBox: false 27 } 28 ] 29 }, 30*/ 31 verbose: false 32}
Explanation:
inline.keyword:
Defines keyword, which marks images you want to replace with inline SVG. Keyword has to be wrapped with whitespace characters (e.g. space).
In case of some conflicts, you can also use data version of your keyword (e.g. data-keyword
).
inline.strict:
In strict mode loader replaces only images with defined keyword. If strict mode is disabled, loader replaces all images.
sprite.keyword:
Defines keyword, which marks images you want to replace with inline SVG using inline sprites. Keyword has to be wrapped with whitespace characters (e.g. space).
In case of some conflicts, you can also use data version of your keyword (e.g. data-keyword
).
sprite.strict:
In strict mode loader replaces only images with defined keyword. If strict mode is disabled, loader replaces all images.
dataAttributes:
Array of attributes which will be renamed to data-attributes.
removeAttributes:
Array of attributes which will be removed.
addAttributes:
Object of attributes which will be added.
addTitle:
Transform image alt
attribute into SVG title
tag, if not defined (removed with SVGO by default). This option has no effect while using inline SVG sprites.
transformImageAttributesToVueDirectives:
Transforms all non-Vue image tag attributes to attributes set via Vue v-bind
directive. With this option enabled, Vue will handle merge / replace attributes, that are present on both resources - image tag and SVG tag. This might cause issues, when using Vue bindings on image tag attribute, that is also present on SVG tag (e.g.: class attribute). Please use verbose option for local debugging before submitting new issue.
md5:
Use md5-encoded resource path as ID for inline SVG sprites instead of plaintext. Set it to false
only for development purposes.
xhtml:
In XHTML mode attribute minimization is forbidden. Empty attributes are filled with their names to be XHTML-compliant (e.g. disabled="disabled"
).
svgo:
Pass SVGO configuration object (documentation can be found here) or true
for default configuration. Pass null
or false
to disable SVG optimization.
verbose:
Will print image tag, SVG tag and modified SVG tag (with attributes from image tag) for debugging purposes.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-01-27
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