Noticeably Playful Monkeys

    vue-svg2-loader

    0.5.0 • Public • Published

    vue-svg-loader

    A webpack loader that allows to use SVG files as Vue Components.

    Installation

    npm i vue-svg2-loader -D
    

    Configuration

    {
      test: /\.svg$/,
      loader: 'vue-svg2-loader', // `vue-svg` for webpack 1.x,
      options: {
          classes: 'default-class-1 default-class-2'
      }
    }

    Example code

    <template>
      <nav id="menu">
        <a href="...">
          <SomeIcon class="icon" />
          Some page
        </a>
      </nav>
    </template>
     
    <script>
    import SomeIcon from './assets/some-icon.svg';
     
    export default {
      name: 'menu',
      components: {
        SomeIcon,
      },
    };
    </script> 

    The idea behind this was inspired by react-svg-loader.

    Install

    npm i vue-svg2-loader

    DownloadsWeekly Downloads

    2

    Version

    0.5.0

    License

    MIT

    Unpacked Size

    19.8 kB

    Total Files

    8

    Last publish

    Collaborators

    • whooooop