From 4051424ec2c4947b7640f737c4f12145b4069807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Couragier?= Date: Sat, 6 Jun 2020 20:06:52 +0200 Subject: [PATCH 1/3] Add sharp fit config option --- lib/sharp.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/sharp.js b/lib/sharp.js index fb696d7..ac2ba4f 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -73,7 +73,8 @@ module.exports = async function sharpVinyl (file, config, options) { image.resize(width, height, { background: config.background, kernel: config.kernel, - withoutEnlargement: config.withoutEnlargement + withoutEnlargement: config.withoutEnlargement, + fit: config.git }) if (config.extractAfterResize) { From fc5d12df06b9c129b6a1de19882fbbdd30ec09be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Couragier?= Date: Sat, 6 Jun 2020 20:24:03 +0200 Subject: [PATCH 2/3] fix typo --- lib/sharp.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sharp.js b/lib/sharp.js index ac2ba4f..7f286a2 100644 --- a/lib/sharp.js +++ b/lib/sharp.js @@ -74,7 +74,7 @@ module.exports = async function sharpVinyl (file, config, options) { background: config.background, kernel: config.kernel, withoutEnlargement: config.withoutEnlargement, - fit: config.git + fit: config.fit }) if (config.extractAfterResize) { From 0d7dcfef3a06b150fa1e37bbb624194c625c9b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Couragier?= Date: Sun, 7 Jun 2020 12:42:00 +0200 Subject: [PATCH 3/3] Add fit option in config + test --- lib/config.js | 3 ++- test/config.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/config.js b/lib/config.js index 3c3be30..8cd4ad9 100644 --- a/lib/config.js +++ b/lib/config.js @@ -85,7 +85,8 @@ const defaultConfig = { withoutChromaSubsampling: false, compressionLevel: 6, format: null, - trim: false + trim: false, + fit: 'cover' } function prepareConfig (config, globalConfig) { diff --git a/test/config.js b/test/config.js index 61e8bad..2ab6f43 100644 --- a/test/config.js +++ b/test/config.js @@ -46,6 +46,7 @@ describe('gulp-responsive', function () { assert.strictEqual(config[0].withoutChromaSubsampling, false) assert.strictEqual(config[0].compressionLevel, 6) assert.strictEqual(config[0].format, null) + assert.strictEqual(config[0].fit, 'cover') }) it('should not override specified values', function () {