Skip to content

auto convert svg to icon component data by webpack plugin

Notifications You must be signed in to change notification settings

lq782655835/svg-icon-webpack-plugin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

svg-icon-webpack-plugin

Auto convert svg to icon component data by webpack plugin。It's base on vue-svgicon component for svg solution。

Install

npm install vue-svgicon svg-icon-webpack-plugin --save-dev

Usage

  1. Configure webpack plugin In vue.config.js
const SvgIconWebpackPlugin = require('svg-icon-webpack-plugin')

module.exports = {
    configureWebpack: {
        plugins: [
            new SvgIconWebpackPlugin({
                // config setting
                sourcePath: './src/assets/svg',
                targetPath: './src/assets/icon',
            })
        ]
    }
}
  1. import result data in entry point file
import * as svgicon from 'vue-svgicon'
Vue.use(svgicon)

// import all icon from webpack plugin build
import './assets/icon'
  1. use svgicon component in vue file
<svgicon name="arrow_down" width="50" height="50"></svgicon>

About

auto convert svg to icon component data by webpack plugin

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published