Gathering detailed insights and metrics for @aidol/svg-icon
Gathering detailed insights and metrics for @aidol/svg-icon
Gathering detailed insights and metrics for @aidol/svg-icon
Gathering detailed insights and metrics for @aidol/svg-icon
A Vue SVG Symbol icon component for svg-sprite-loader, Easy to custom SVG icon 's color and size!!!
npm install @aidol/svg-icon
Typescript
Module System
Node Version
NPM Version
Vue (58.03%)
JavaScript (30.75%)
HTML (11.23%)
Total Downloads
5,134
Last Day
7
Last Week
22
Last Month
85
Last Year
723
MIT License
1 Stars
31 Commits
1 Watchers
2 Branches
1 Contributors
Updated on Aug 22, 2023
Minified
Minified + Gzipped
Latest Version
2.1.4
Package Id
@aidol/svg-icon@2.1.4
Unpacked Size
66.61 kB
Size
13.22 kB
File Count
8
NPM Version
6.14.17
Node Version
14.21.1
Published on
Mar 01, 2023
Cumulative downloads
Total Downloads
1
WARNING: This Package is no longer maintained, Please use vue-symbol-icon instead.
A Vue SVG Symbol icon component for svg-sprite-loader, Easy to custom SVG icon 's color
and size
!!!
TIPS:
@aidol/svg-icon
needs to be used in conjunction withsvg-sprite-loader
. So, please pre-install svg-sprite-loader and config it.
font-size
and color
.1# pnpm 2$ pnpm add @aidol/svg-icon 3 4# yarn 5$ yarn add @aidol/svg-icon 6 7# npm 8$ npm i @aidol/svg-icon
demo.vue
1<template> 2 <svg-icon icon-class="svg-symbol-id" font-size="36px" color="red" /> 3</template>
Prop name | Default value | Required | Description | Type |
---|---|---|---|---|
icon-class | undefined | true | SVG Symbol Id which is SVG filename in the SVG folder. | string |
className | undefined | false | Add Extra class name to SVG Element | string |
color | undefined | false | Define SVG color | string |
fontSize | undefined | false | Define SVG size | string |
Vue CLI
webpack
with chainWebpack
:1// vue.config.js 2const path = require('path') 3 4function resolve(dir) { 5 return path.join(__dirname, dir) 6} 7 8module.exports = { 9 // ... 10 chainWebpack(config) { 11 12 // Change the configuration of url-loader so that it does not process svg files used as icons in the specified folder 13 config.module 14 .rule("svg") 15 .exclude.add(resolve("src/icons")) 16 .end(); 17 18 // Add svg-sprite-loader to process svg files in the specified folder 19 config.module 20 .rule("icons") 21 .test(/\.svg$/) 22 .include.add(resolve("src/icons")) 23 .end() 24 .use("svg-sprite-loader") 25 .loader("svg-sprite-loader") 26 .options({ 27 symbolId: "icon-[name]" 28 }) 29 .end(); 30 } 31}
Then, place your .svg
icon files in the src/icons/svg
folder.
Defines the entry point for batch importing .svg
modules:
1// src/icons/index.js 2 3import Vue from 'vue' 4import SvgIcon from '@aidol/svg-icon' // svg component 5 6// 1. register globally 7Vue.component('svg-icon', SvgIcon) 8 9// 2. require svg files 10const req = require.context('./svg', false, /\.svg$/) 11const requireAll = requireContext => requireContext.keys().forEach(requireContext) 12requireAll(req)
.svg
files are centrally imported in the project entry file main.js
.1import Vue from 'vue' 2 3import '@/icons' 4 5new Vue({ 6 // ... 7})
webpack
in the nuxt.config.js
:1// nuxt.config.js 2 3export default { 4 // ... 5 // Build Configuration (https://go.nuxtjs.dev/config-build) 6 build: { 7 /* 8 ** You can extend webpack config here 9 */ 10 extend(config, { isClient }) { 11 if (isClient) { 12 const svgRule = config.module.rules.find((rule) => 13 rule.test.test('.svg') 14 ) 15 svgRule.exclude = [resolve('assets/icons/svg')] 16 17 // Includes /assets/icons/svg for svg-sprite-loader 18 config.module.rules.push({ 19 test: /\.svg$/, 20 include: [resolve('assets/icons/svg')], 21 loader: 'svg-sprite-loader', 22 options: { 23 symbolId: 'icon-[name]', 24 }, 25 }) 26 } 27 }, 28 } 29 // ... 30}
Centralize your *.svg
icon files in the ~/assets/icons/svg
folder.
Create a new ~/plugins/svg-icon.js
file and write in it:
1import Vue from 'vue' 2import SvgIcon from '@aidol/svg-icon' // svg component 3 4// 1. register globally 5Vue.component('svg-icon', SvgIcon) 6 7// 2. require svg files 8const req = require.context('~/assets/icons/svg', false, /\.svg$/) 9const requireAll = (requireContext) => requireContext.keys().forEach(requireContext) 10requireAll(req)
nuxt.config.js
:1export default { 2 // ... 3 4 plugins: [ 5 // ... 6 { src: '~/plugins/svg-icon', mode: 'client' } 7 ] 8 9 // ... 10}
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
project is archived
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
Reason
33 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-30
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 MoreLast Day
0%
7
Compared to previous day
Last Week
175%
22
Compared to previous week
Last Month
51.8%
85
Compared to previous month
Last Year
-26.2%
723
Compared to previous year