Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

responsive-loader

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

responsive-loader - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

6

CHANGELOG.md
# Change Log
## v1.0.0 [Unreleased]
## v1.1.0
- Added `min` and `max` options to automatically generate a number of images, and `steps` option to say how many images ([#31](https://github.com/herrstucki/responsive-loader/pull/31)).
## v1.0.0
### New

@@ -6,0 +10,0 @@

@@ -21,3 +21,2 @@ 'use strict';

var config = Object.assign({}, loaderUtils.getOptions(this), parsedResourceQuery);
var sizes = config.size || config.sizes || [Number.MAX_SAFE_INTEGER];
var outputContext = config.context || '';

@@ -58,2 +57,18 @@ var outputPlaceholder = Boolean(config.placeholder) || false;

var min = config.min !== undefined ? parseInt(config.min, 10) : undefined;
var max = config.max !== undefined ? parseInt(config.max, 10) : undefined;
var steps = config.steps === undefined ? 4 : parseInt(config.steps, 10);
var generatedSizes = void 0;
if (typeof min === 'number' && max) {
generatedSizes = [];
for (var step = 0; step < steps; step++) {
var _size = min + (max - min) / (steps - 1) * step;
generatedSizes.push(Math.ceil(_size));
}
}
var sizes = parsedResourceQuery.size || parsedResourceQuery.sizes || generatedSizes || config.size || config.sizes || [Number.MAX_SAFE_INTEGER];
if (!sizes) {

@@ -60,0 +75,0 @@ return loaderCallback(null, content);

2

package.json
{
"name": "responsive-loader",
"version": "1.0.0",
"version": "1.1.0",
"description": "A webpack loader for responsive images",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -116,2 +116,5 @@ # responsive-loader

- `size: integer` — specify one width you want to use; if the specified size exceeds the original image's width, the latter will be used (i.e. images won't be scaled up)
- `min: integer` - as an alternative to manually specifying `sizes`, you can specify `min`, `max` and `steps`, and the sizes will be generated for you.
- `max: integer` - see `min` above
- `steps: integer` - configure the number of images generated between `min` and `max` (inclusive). Defaults to 4.
- `quality: integer` — JPEG compression quality; defaults to `85`

@@ -118,0 +121,0 @@ - `format: string` — either `png` or `jpg`; use to convert to another format; default format is inferred from the source file's extension

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