diff --git a/CHANGELOG.md b/CHANGELOG.md index aa957a9..3ec1a3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 2.0.10 + +- handle url null in bundled configs + # 2.0.9 - Added classes to picture and imag elements to make more stylable diff --git a/package.json b/package.json index 8c9643f..b01128c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-picture", - "version": "2.0.9", + "version": "2.0.10", "scripts": { "ng": "ng", "start": "ng s --vendor-source-map=true", diff --git a/projects/ngx-picture/package.json b/projects/ngx-picture/package.json index 16334dc..e0b255b 100644 --- a/projects/ngx-picture/package.json +++ b/projects/ngx-picture/package.json @@ -1,6 +1,6 @@ { "name": "ngx-picture", - "version": "2.0.9", + "version": "2.0.10", "repository": { "type": "git", "url": "https://github.com/jaychase/ngx-picture.git" diff --git a/projects/ngx-picture/src/lib/cloudinary-config.ts b/projects/ngx-picture/src/lib/cloudinary-config.ts index 008db21..2e3643e 100644 --- a/projects/ngx-picture/src/lib/cloudinary-config.ts +++ b/projects/ngx-picture/src/lib/cloudinary-config.ts @@ -8,10 +8,12 @@ export function cloudinarySrcInterpolator( breakpoint: string, breakpointValue: number ): string { - return `${url.replace( - 'upload/', - 'upload/w_' + breakpointValue + '/f_' + imageFormat + '/' - )}`; + return url + ? `${url.replace( + 'upload/', + 'upload/w_' + breakpointValue + '/f_' + imageFormat + '/' + )}` + : null; } export const CLOUDINARY_CONFIG: NgxPictureConfig = { diff --git a/projects/ngx-picture/src/lib/graph-cms-config.ts b/projects/ngx-picture/src/lib/graph-cms-config.ts index 8f6a4e1..008c01a 100644 --- a/projects/ngx-picture/src/lib/graph-cms-config.ts +++ b/projects/ngx-picture/src/lib/graph-cms-config.ts @@ -8,9 +8,11 @@ export function graphCmsSrcInterpolator( breakpoint: string, breakpointValue: number ): string { - return `https://media.graphcms.com/resize=w:${breakpointValue},fit:scale/output=format:${ - imageFormat === 'jpeg' ? 'jpg' : 'webp' - }/${url.replace('https://media.graphcms.com/', '')}`; + return url + ? `https://media.graphcms.com/resize=w:${breakpointValue},fit:scale/output=format:${ + imageFormat === 'jpeg' ? 'jpg' : 'webp' + }/${url.replace('https://media.graphcms.com/', '')}` + : null; } export const GRAPH_CMS_CONFIG: NgxPictureConfig = { diff --git a/projects/ngx-picture/src/lib/imagekit-config.ts b/projects/ngx-picture/src/lib/imagekit-config.ts index 4c655b8..800de76 100644 --- a/projects/ngx-picture/src/lib/imagekit-config.ts +++ b/projects/ngx-picture/src/lib/imagekit-config.ts @@ -9,10 +9,12 @@ export function imagekitSrcInterpolator( breakpointValue: number ): string { const fileName = url.substring(url.lastIndexOf('/')); - return `${url.replace( - fileName, - '/tr:w-' + breakpointValue + ',f-' + imageFormat + fileName - )}`; + return url + ? `${url.replace( + fileName, + '/tr:w-' + breakpointValue + ',f-' + imageFormat + fileName + )}` + : null; } export const IMAGEKIT_CONFIG: NgxPictureConfig = {