From 1096364b51fe77d15f45ba3f2dcc0c5497d608be Mon Sep 17 00:00:00 2001 From: Manuel Odelain Date: Fri, 24 May 2024 10:10:28 +0200 Subject: [PATCH] feat: handle image formats other than webp --- playground/app.vue | 5 +++++ src/runtime/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/playground/app.vue b/playground/app.vue index 8d2a6f5..71ce5ac 100644 --- a/playground/app.vue +++ b/playground/app.vue @@ -57,6 +57,11 @@
No process image:
+ +
+
Avif format:
+ +
diff --git a/src/runtime/index.ts b/src/runtime/index.ts index fe5c832..79e3a1e 100644 --- a/src/runtime/index.ts +++ b/src/runtime/index.ts @@ -79,8 +79,8 @@ export function getImage( // process modifiers const operationsString = operations.join('-') - if (format === 'webp' && !src.endsWith('.webp')) { - src += '.webp' + if (format && !src.endsWith('.' + format)) { + src += '.' + format } const getUrl = function (): string {