Socket
Socket
Sign inDemoInstall

advanced-url-loader

Package Overview
Dependencies
7
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    advanced-url-loader

> Based on [url-loader](https://github.com/webpack/url-loader)


Version published
Weekly downloads
6
increased by200%
Maintainers
1
Install size
286 kB
Created
Weekly downloads
 

Readme

Source

Advanced url loader for Webpack

Based on url-loader

Works exactly like url-loader but allows to specify how encode specific MIME-type. For example for SVG there is no necessary to encode source in base64, because it works with raw content encoded with encodeURIComponent as well. It will decrease ~30% of content length and save browser resources for unpacking base64 string.

Configuration

For compatibility with url-loader advancedUrl option is used:

{
  module: {
    loaders: [
      {
        test: /\.(jpg|png|gif|svg)$/,
        loader: 'advanced-url?limit=10000'
      }
    ]
  },
  advancedUrl: {
    handlers: {
      'image/svg+xml': function (content) {
        return 'data:image/svg+xml,' + encodeURIComponent(content);
      }
    }
  }
}

FAQs

Last updated on 03 Feb 2016

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc