Socket
Socket
Sign inDemoInstall

img-size-loader

Package Overview
Dependencies
1
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    img-size-loader

webpack image size loader. does not emit file


Version published
Maintainers
1
Install size
29.6 kB
Created

Readme

Source

Webpack image size loader

NPM

Webpack image size loader. This loader

  • Returns size info only
  • Does not emit file
  • Has no side effect
  • Is totally compatible with any other loaders (e.g. file-loader url-loader). Check usage for detail

Usage

  • Install With yarn: yarn add -D img-size-loader
  • Or install with npm: npm install --save-dev img-size-loader
  • It is highly recommended to overloading other loaders by preceding inline loader with punctuation(!)
  • Import example
//leading punctuation (!)
//otherwise, will conflict with other loaders
import ImageWithSize from '!img-size-loader!./log.png'
//assume that '*.png' is loaded via `url-loader`, `file-loader`, ... by default
import ImageWithoutSize from './log.png'

console.log(ImageWithSize)
//output: { width: 1379, height: 991, type: 'png' }
console.log(ImageWithoutSize)
//output: http://127.0.0.1:8080/bundles/price_8a330fe5105f76b9a439f58cce44572c.png

Dependencies

FAQs

Last updated on 03 Dec 2018

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