
nuxtimg, categories composabled, tailwind config in js, remove comments, next question operation, media fit
18 lines
452 B
TypeScript
18 lines
452 B
TypeScript
import { joinURL } from 'ufo';
|
|
import type { ProviderGetImage } from '@nuxt/image';
|
|
import { createOperationsGenerator } from '#image';
|
|
|
|
const operationsGenerator = createOperationsGenerator();
|
|
|
|
export const getImage: ProviderGetImage = (
|
|
src,
|
|
{ modifiers = {}, baseUrl } = {},
|
|
) => {
|
|
baseUrl ??= '';
|
|
|
|
const operations = operationsGenerator(modifiers);
|
|
|
|
return {
|
|
url: joinURL(baseUrl, src + (operations ? '?' + operations : '')),
|
|
};
|
|
};
|