@nuxt/image
Version:
Nuxt Image Module
10 lines (9 loc) • 388 B
JavaScript
import { getQuery, withBase, withQuery } from "ufo";
import { operationsGenerator } from "./imgix.js";
export const unsplashCDN = "https://images.unsplash.com/";
export const getImage = (src, { modifiers = {}, baseURL = unsplashCDN } = {}) => {
const operations = operationsGenerator(modifiers);
return {
url: withQuery(withBase(src, baseURL), getQuery("?" + operations))
};
};