@giakki/responsive-adapter-ext
v0.0.3
Published
Custom adapter for responsive-loader
Downloads
4
Readme
responsive-adapter-ext
Custom Sharp adapter for responsive-loader.
Installation
npm install --save-dev responsive-adapter-ext responsive-loader sharp
Usage
import { adapter} from 'responsive-loader-ext';
...
{
test: /\.(jpe?g|png)$/i,
loader: 'responsive-loader',
options: {
adapter,
},
}
Supported operations
In addition to the standard operations supported by responsive-loader
, this adapter supports resizing by aspect ratio and by height.
For example, starting with this reference image (512x512 pixels):
Resizing and cropping by aspect ratio
require('lenna.png?resize=true&width=512&aspectRatio=7/5');
Resizing and cropping by height
require('lenna.png?resize=true&height=100');