@peterek/vite-plugin-favicons
Version:
Simple Vite plugin to generate favicons from source image. Nothing more, nothing less.
17 lines (14 loc) • 440 B
JavaScript
module.exports = (icons, outputMiddleware) => {
return async function configureServer(server) {
const { images, files } = await icons
const mw = server.middlewares
return () => {
files.forEach(({ name, contents }) => {
mw.use(`/${name}`, outputMiddleware(name, contents))
})
images.forEach(({ name, contents }) => {
mw.use(`/${name}`, outputMiddleware(name, contents))
})
}
}
}