gatsby-plugin-storyblok-image
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -10,4 +10,4 @@ "use strict"; | ||
breakpoints: [750, 1080, 1366, 1920], | ||
fit: 'cover', | ||
fitIn: false, | ||
fitInColor: 'transparent' | ||
}; |
@@ -8,3 +8,3 @@ export interface GetGatsbyImageOptions { | ||
breakpoints?: number[]; | ||
fit?: 'cover' | 'contain'; | ||
fitIn?: boolean; | ||
fitInColor?: string; | ||
@@ -21,3 +21,3 @@ backgroundColor?: string; | ||
fitInColor: string; | ||
fit: 'cover' | 'contain'; | ||
fitIn: boolean; | ||
} |
import { MergedGetGatsbyImageOptions } from '../typings/module'; | ||
interface Image extends Partial<Pick<MergedGetGatsbyImageOptions, 'width' | 'height' | 'smartCrop' | 'quality' | 'fit' | 'fitInColor'>> { | ||
interface Image extends Partial<Pick<MergedGetGatsbyImageOptions, 'width' | 'height' | 'smartCrop' | 'quality' | 'fitIn' | 'fitInColor'>> { | ||
} | ||
export default function buildImageUrl(originalPath: string, image: Image): string; | ||
export declare function buildLowFiUrl(originalPath: string, opt?: Pick<Image, 'fit'>): string; | ||
export declare function buildLowFiUrl(originalPath: string, opt?: Pick<Image, 'fitIn'>): string; | ||
export {}; |
@@ -9,3 +9,3 @@ "use strict"; | ||
function buildImageUrl(originalPath, image) { | ||
const { width, height, smartCrop, quality, fit, fitInColor } = image; | ||
const { width, height, smartCrop, quality, fitIn, fitInColor } = image; | ||
// const [, extension] = originalPath.split('.') | ||
@@ -22,2 +22,5 @@ // base url | ||
url += originalPath + '/m'; | ||
if (fitIn) { | ||
url += '/fit-in'; | ||
} | ||
if (width || height) { | ||
@@ -29,7 +32,6 @@ url += `/${width || 0}x${height || 0}`; | ||
} | ||
const fitToContain = fit === 'contain'; | ||
const filters = [ | ||
quality && `quality(${quality})`, | ||
// format && format !== extension && `format(${format})`, | ||
fitToContain && `fill(${(fitInColor || TRANSPARENT).replace('#', '')})` | ||
fitIn && `fill(${(fitInColor || TRANSPARENT).replace('#', '')})` | ||
].filter(Boolean); | ||
@@ -50,5 +52,5 @@ if (filters.length > 0) { | ||
quality: 10, | ||
fit: opt === null || opt === void 0 ? void 0 : opt.fit | ||
fitIn: opt === null || opt === void 0 ? void 0 : opt.fitIn | ||
}); | ||
} | ||
exports.buildLowFiUrl = buildLowFiUrl; |
{ | ||
"name": "gatsby-plugin-storyblok-image", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Adds gatsby-plugin-image to Gatsby & Storyblok as a content source.", | ||
@@ -5,0 +5,0 @@ "main": "dist/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
310
15998