responsive-loader
Advanced tools
Comparing version 0.5.0 to 0.5.1
12
index.js
@@ -74,7 +74,13 @@ /* eslint-disable */ | ||
var q = queue(); | ||
var widthsToGenerate = new Set(); | ||
(Array.isArray(sizes) ? sizes : [sizes]).forEach(function(size) { | ||
var width = Math.min(img.bitmap.width, parseInt(size, 10)); | ||
q.defer(resizeImage, width); | ||
// Only resize images if they aren't an exact copy of one already being resized... | ||
if (!widthsToGenerate.has(width)) { | ||
widthsToGenerate.add(width); | ||
q.defer(resizeImage, width); | ||
} | ||
}); | ||
@@ -92,3 +98,3 @@ | ||
var firstImagePath = files[0].path; | ||
loaderCallback(null, 'module.exports = {srcSet:' + srcset + ',images:[' + images + '],src:' + firstImagePath + ',toString:function(){return ' + firstImagePath + '}};'); | ||
@@ -95,0 +101,0 @@ }); |
{ | ||
"name": "responsive-loader", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "A webpack loader for responsive images", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9861
84