1.0.12 • Published 3 years ago

webpack-svg-sprite-load-demand v1.0.12

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

webpack-svg-sprite-load-demand

English | 简体中文

This is a webpack plug-in that generates svg sprite on demand. It is currently in the trial stage of vue and supports webpack 4 and 5. Please refer to the test directory for usage.

Install

  npm i webpack-svg-sprite-load-demand -D

Usage

  • entryRoot

    Project entry root directory

      new WebpackSvgLoadDemand({
        entryRoot: './test'}
      ),

Example

Take vue.config.js in vue cli as an example

vue.config.js

  const WebpackSvgLoadDemand = require('webpack-svg-sprite-load-demand');
  module.exports = {
    configureWebpack: config => {
       config.plugins = [
        ...config.plugins,
        new WebpackSvgLoadDemand({
          entryRoot: './src'
        }),
      ]
    }
  }

global SFC svg-icon

  <template functional>
    <svg aria-hidden="true">
      <use :xlink:href="`#${props.xlink}`"/>
    </svg>
  </template>

template

  <svg-icon class="svg-icon" svg-path="assets/svgs/test/safe.svg" xlink="safe"></svg-icon>
1.0.11

3 years ago

1.0.12

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.10

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago