3.0.1 • Published 4 months ago

svgo-loader v3.0.1

Weekly downloads
179,850
License
MIT
Repository
github
Last release
4 months ago

svgo loader for webpack

Install

$ npm install svgo-loader --save-dev

... or with Yarn

$ yarn add svgo-loader -D

Usage

Documentation: Using loaders

module.exports = {
  ...,
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'file-loader'
          },
          {
            loader: 'svgo-loader',
          }
        ]
      }
    ]
  }
}

By default svgo-loader uses config from svgo.config.js similar to svgo cli. See how to configure svgo.

Specify configFile option to load custom config module:

module.exports = {
  ...,
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'file-loader'
          },
          {
            loader: 'svgo-loader',
            options: {
              configFile: './scripts/svgo.config.js'
            }
          }
        ]
      }
    ]
  }
}

or to disable loading config:

module.exports = {
  ...,
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'file-loader'
          },
          {
            loader: 'svgo-loader',
            options: {
              configFile: false
            }
          }
        ]
      }
    ]
  }
}

You can also specify options which override loaded from config

module.exports = {
  ...,
  module: {
    rules: [
      {
        test: /\.svg$/,
        use: [
          {
            loader: 'file-loader'
          },
          {
            loader: 'svgo-loader',
            options: {
              multipass: true,
              js2svg: {
                indent: 2,
                pretty: true,
              }
            }
          }
        ]
      }
    ]
  }
}

License and Copyright

This software is released under the terms of the MIT license.

@s-isabella/scripts-frontend@quantumblack/carbon-charts@mygooder/react-scriptstrading-vue-101@space-designsystem/core@codewitchbella/scripts-frontend@ywjt/spa-m-builder@webpack-rewired/core@wmadfaa/custom-react-scripts@wmadfaa/full-settings-react-scripts@wmadfaa/react-script@wmadfaa/react-scripts@wingsuit-designsystem/core@xwx/react-scriptsaigobao-online@zumper/react-scriptsadvanced-react-scripts@bybit/marvel-cli@eaze/eaze-web-scriptsreact-starter-projectreact-static-plugin-svgreact-scripts-wetimereact-scripts-bsdrocktime-webpack@firestqr/storyblocks@epam/uui-build@amilabs/pink-unicorn@anansi/webpack-config@bolster/boulder-webpack-config@bolt/build-tools@blunck/webpack-scripts@blueking/bk-monitor-cli@blueking/bkmonitor-cli@bolt/uikit-workshop@buncho/webpack-config@baiyun/yun-tools@moxy/next-common-files@molejs/mole-dev-utils@nerdgeschoss/config@netwerkdigitaalerfgoed/ldwizard@neverbland/react-scripts@app-cli/service@appsemble/webpack-config@micro-app/plugin-vuepress@jsrock/webpack@mediamonks/richmedia-temple-server@meniga/cli@lcooper/app-scripts@aktiv/cli@lighting-beetle/light-react-scripts@lighting-beetle/lighter-react-scripts@mad-js-dev/custom-uikit-workshop-mad-js-dev@madie/madie-design-system@mostlyserious/brightpack@mucha48/tydic-component-setsuper-design-iconsumi-plugin-svgotip-message-pluginvussrwebpack-abstractwolf-builderwebpack-config-aswub-preset-svgorocket-startersa-template-2rjankoryoko-uiry-webseek-style-guide-webpackscoobieskusku-for-testingstanzarizeym-svg-spritexix-cli@epay-sparta/cli-service@triply/ldwizard-core@dvhb/cli@dvhb/webpack@4tw/vue-cli-plugin-svg-icon@cirrusct/mr-build-webapp-webpack@pixolith/webpack-sw6-config@pixolith/webpack-typo3-config@pldn/ldwizard@patricia_engineering/patricia-ui-components@plone/plone-react@plone/volto@dennisdigital/polaris-components-styleguide@dpc-sdp/ripple-nuxt-ui@v4fire/client@uswitch/trustyle.themed-iconbsl-buildccs-template-uicraco-plugin-svg-spritecrazy-taxibeauty-webpack-v1blazar-coreautofe-scriptsaurornz-react-scriptsaviate
3.0.1

4 months ago

3.0.0

2 years ago

2.2.2

2 years ago

2.2.1

3 years ago

2.2.0

4 years ago

2.1.0

5 years ago

2.0.0

5 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

8 years ago

1.0.0

8 years ago