npm.devtool.tech
👏 You can access svgo-loader package with using svgoLoader variable in browser devtools!
svgo loader for webpack

code/package/bundle size

0B
publish
0B
install
0B
bundle minified
0B
bundle gzipped

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.

🔎Explore Package🔎CDN Script

Score

Popularity31/100
Quality50/100
Maintenance99/100