From f71b348c71d9b9a8aa3e4f17ff2cffac73690c99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Miguel?= Date: Tue, 24 Jul 2018 17:56:49 +0100 Subject: [PATCH 1/2] #86 Fix case sensitivity in responsive images --- components/SrcSet.jsx | 2 +- scripts/sharp.js | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/SrcSet.jsx b/components/SrcSet.jsx index 59e53ca..e7a7e7d 100644 --- a/components/SrcSet.jsx +++ b/components/SrcSet.jsx @@ -7,7 +7,7 @@ const buildSrcSet = (src) => { const ext = chunks.pop(); // We don't build a srcset if we won't have any responsive images built for this src image. - if (sharpConfig.types.indexOf(ext) === -1) { + if (sharpConfig.types.indexOf(ext.toLowerCase()) === -1) { return null; } diff --git a/scripts/sharp.js b/scripts/sharp.js index c6d473e..c5b16a4 100644 --- a/scripts/sharp.js +++ b/scripts/sharp.js @@ -228,7 +228,13 @@ const deleteProcessedImages = imagePath => new Promise((resolve) => { }); const processAllImages = () => new Promise((resolve, reject) => { - glob(`${src}/**/*.+(${[ ...types ].join('|')})`, {}, (err, images) => { + const pattern = `${src}/**/*.+(${[ ...types ].join('|')})`; + + const options = { + nocase: true, + }; + + glob(pattern, options, (err, images) => { if (err) { reject(err); return; From 35d72f89a9aab1b43ca86f61d1bf30f94647f510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Miguel?= Date: Tue, 24 Jul 2018 17:57:39 +0100 Subject: [PATCH 2/2] #86 nit --- scripts/sharp.js | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/sharp.js b/scripts/sharp.js index c5b16a4..e1d8e5a 100644 --- a/scripts/sharp.js +++ b/scripts/sharp.js @@ -229,7 +229,6 @@ const deleteProcessedImages = imagePath => new Promise((resolve) => { const processAllImages = () => new Promise((resolve, reject) => { const pattern = `${src}/**/*.+(${[ ...types ].join('|')})`; - const options = { nocase: true, };