Socket
Socket
Sign inDemoInstall

svg-inline-loader

Package Overview
Dependencies
Maintainers
6
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svg-inline-loader

Cleans up and inlines your SVG files into Webpack module.


Version published
Weekly downloads
172K
decreased by-1.73%
Maintainers
6
Weekly downloads
 
Created

What is svg-inline-loader?

The svg-inline-loader npm package is a Webpack loader that inlines SVG files, allowing you to import SVGs directly into your JavaScript or TypeScript files. This can be useful for manipulating SVGs with JavaScript, applying styles, or optimizing SVGs for better performance.

What are svg-inline-loader's main functionalities?

Inline SVG Import

This feature allows you to import an SVG file directly into your JavaScript or TypeScript code. The SVG content is inlined, which means it is included directly in the JavaScript bundle, allowing for easier manipulation and styling.

const mySvg = require('svg-inline-loader!./path/to/my.svg');

SVG Optimization

By configuring Webpack to use svg-inline-loader for SVG files, you can ensure that all SVGs are inlined and optimized during the build process. This can help reduce the number of HTTP requests and improve performance.

module: { rules: [ { test: /\.svg$/, use: [ 'svg-inline-loader' ] } ] }

Custom Attributes

This feature allows you to customize the behavior of the loader, such as preserving or removing certain attributes from the SVG tags. This can be useful for maintaining specific SVG properties or optimizing the SVG content further.

module: { rules: [ { test: /\.svg$/, use: [ { loader: 'svg-inline-loader', options: { removeSVGTagAttrs: false } } ] } ] }

Other packages similar to svg-inline-loader

Keywords

FAQs

Package last updated on 17 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc