0.16.0 • Published 4 years ago

vue-svg-loader v0.16.0

Weekly downloads
96,925
License
MIT
Repository
github
Last release
4 years ago

Installation

npm i -D vue-svg-loader

yarn add --dev vue-svg-loader

Basic configuration

webpack

module.exports = {
  module: {
    rules: [
      {
        test: /\.svg$/,
        loader: 'vue-svg-loader',
      },
    ],
  },
};

Vue CLI

module.exports = {
  chainWebpack: (config) => {
    const svgRule = config.module.rule('svg');

    svgRule.uses.clear();

    svgRule
      .use('vue-svg-loader')
      .loader('vue-svg-loader');
  },
};

Nuxt.js (1.x / 2.x)

module.exports = {
  build: {
    extend: (config) => {
      const svgRule = config.module.rules.find(rule => rule.test.test('.svg'));

      svgRule.test = /\.(png|jpe?g|gif|webp)$/;

      config.module.rules.push({
        test: /\.svg$/,
        loader: 'vue-svg-loader',
      });
    },
  },
};

Example usage

<template>
  <nav>
    <a href="https://github.com/vuejs/vue">
      <VueLogo />
      Vue
    </a>
    <a href="https://github.com/svg/svgo">
      <SVGOLogo />
      SVGO
    </a>
    <a href="https://github.com/webpack/webpack">
      <WebpackLogo />
      webpack
    </a>
  </nav>
</template>
<script>
import VueLogo from './public/vue.svg';
import SVGOLogo from './public/svgo.svg';
import WebpackLogo from './public/webpack.svg';

export default {
  name: 'Example',
  components: {
    VueLogo,
    SVGOLogo,
    WebpackLogo,
  },
};
</script>

License

FOSSA Status

@vueux/explorerdp-bz-common@infinitebrahmanuniverse/nolb-vue-sv@everything-registry/sub-chunk-3093vue-runnervue-build-nonssrwebpack4-defaultswk-bz-commonwelz-ui-component-betavussrvue-simple-gallery-slidervue-question-editvue-cli-plugin-svgvue-local-no-ssrtable-bulgo-apptheme-makersvg-module-nextunicorn-vue-toastervue-cli-plugin-svg-vue3vue-lazy-svg-imagevueui-doc-genvuepress-theme-single-page-sections@lewebsimple/webpack4-defaults@lewebsimple/webpack5-config@invisibledragon/kitgridsome-plugin-svg@nuxtjs/svg@dword-design/base-config-vue-app@dword-design/base-type-vue@rg-wp/configemp-plugin-babel-vue-3empiricus-css@jetsquid/theme-makerhoahoney-cli@ra_wm/front-kithotelsafehousfy-uihousfy-ui-lib@otron/plugin-babel-vue3@otron/plugin-vue2@otron/plugin-vue3@flickerbox/build@shipnity/template@fbi-js/webpack-config-vue@pkgr/webpack-vue@efox/emp-vue2@efox/plugin-babel-vue-3@efox/plugin-vue-2@efox/plugin-vue-3heimdall-litekocktail-docskingcs_antdui@studiometa/webpack-config-preset-vue-3@studiometa/webpack-config-preset-vue-2my_npm_component@batch/craft-webpack@xiaobaoonline/spui3sis@vagrantir/rc-device-targetinglib-26-01-02type@yqg/cli@wangzb/kangpaas-ui@zdgt/kangpaas-ui@amrnn/vuepackairlst-cotyluxuryexperts-douglas-widgetairlst-cotyluxuryexperts-mueller-widgetairlst-cotyluxuryexperts-widgetairlst-proftreff20-survey-widgetairlst-proftreff20-widgetairlst-registration-widgetbulgo-spa-librarybegin-build@uibase/uibase-vue@we-make-websites/basis@vuemodules/headersimplelogin-bulgo-app@alexandrov/vue-build-devcib-design-systemosmanli-veri-dagitim@chrisbielak/svg-modulebrewblox-uipostmanify@doxlab/atomleafprinter-logic-componentscore-user-dashcomento-uicomento-ui-practicenuxt-basenuxt-svgdenidedh-componentsshark-feskola-components
0.17.0-beta.2

4 years ago

0.17.0-beta.1

4 years ago

0.17.0-beta.0

4 years ago

0.16.0

4 years ago

0.15.0

4 years ago

0.14.0

4 years ago

0.13.0

4 years ago

0.12.0

5 years ago

0.12.0-alpha.1

5 years ago

0.11.0

6 years ago

0.10.0

6 years ago

0.9.0

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago