An open API service indexing awesome lists of open source software.

https://github.com/hipstersmoothie/probe-image-size-loader

Uses probe-image-size to inject the height and width into image imports.
https://github.com/hipstersmoothie/probe-image-size-loader

Last synced: 2 months ago
JSON representation

Uses probe-image-size to inject the height and width into image imports.

Awesome Lists containing this project

README

        

[![CircleCI](https://img.shields.io/circleci/project/github/hipstersmoothie/probe-image-size-loader.svg?style=for-the-badge)](https://circleci.com/gh/hipstersmoothie/probe-image-size-loader)
[![Codecov branch](https://img.shields.io/codecov/c/github/hipstersmoothie/probe-image-size-loader/master.svg?style=for-the-badge)](https://github.com/hipstersmoothie/probe-image-size-loader)
[![npm](https://img.shields.io/npm/v/probe-image-size-loader.svg?style=for-the-badge)](https://www.npmjs.com/package/probe-image-size-loader)
[![npm](https://img.shields.io/npm/dt/probe-image-size-loader.svg?style=for-the-badge)](https://www.npmjs.com/package/probe-image-size-loader)





Probe-Image-Size Loader


Uses probe-image-size to inject the height and width into image imports.


## Install

```bash
yarn add -D probe-image-size-loader
```

## Usage

Can also be used with [lqip-loader](https://github.com/zouhir/lqip-loader).

**webpack.config.js**

```javascript
module.exports = {
module: {
rules: [
{
test: /\.png$/,
use: ['probe-image-size-loader', 'file-loader']
}
]
}
};
```

**Output**

```javascript
module.exports = {
src: __dirname + 'some/path/to/image.png',
height: 100,
width: 200
};
```

**Usage in JS files**

```javascript
import image from './image.png';

const Image = () => (

);
```

### Example

```
$ cd example
$ yarn
$ yarn build
$ node dist/main.js

{
src: 'cb12bc24511449db821768715e85b0d9.gif',
height: 208,
width: 220
}
```