Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svg-icon-jdc

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-icon-jdc

vue svg-loader 精灵图

  • 1.0.3
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

说明

一款快速调用 svg 中 use id的模版,适合精灵图开发

使用说明

js部分

import svgIcon from 'svg-icon-jdc';
svgIcon.install(Vue);
// 倒入需要规范的 svg 文件
const req = require.context('./../../asset/svgSprite', false, /\.svg$/)
const requireAll = requireContext => {
    requireContext.keys().map(requireContext)
}
requireAll(req)

webpack部分 如果没有 file-loader 等文件路径工具只需要如下

{
    test: /\.svg$/,
    loader: 'svg-sprite-loader',
    include:[path.resolve('src/asset/svgSprite')],
    options:{
        symbolId:'icon-[name]'
    }
}

如果有 file/url 等文件路径路径工具 需要添加 对应的路径来忽略这个文件 exclude:[path.resolve('src/asset/svgSprite')] 下面是一个loader的配置例子

{
    test: /\.(png|jpg|gif|webp|woff|eot|ttf|svg)$/,
    use:{
        loader:'url-loader',
        options:{
            name:'img/[name].[ext]',
            limit:3000
        }
    },
    exclude:[path.resolve('src/asset/svgSprite')]
    
}

Keywords

FAQs

Package last updated on 21 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc