Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ const defaultConfig = {
withoutChromaSubsampling: false,
compressionLevel: 6,
format: null,
trim: false
trim: false,
fit: 'cover'
Copy link
Collaborator

@StarpTech StarpTech Jun 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default option is centre https://sharp.pixelplumbing.com/api-resize#resize that change would be breaking.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're mistaking. According to the documentation the "fit" parameter default value is "cover". See here :
https://sharp.pixelplumbing.com/api-resize#resize
Centre is the "position" param default value.

}

function prepareConfig (config, globalConfig) {
Expand Down
3 changes: 2 additions & 1 deletion lib/sharp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.fit
})

if (config.extractAfterResize) {
Expand Down
1 change: 1 addition & 0 deletions test/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down