还有一个外观插件 。 @ @ info
特征
- 为每个图标类型指定不同的源资产(即:
favicon.png以给养,startup.png页:1 苹果启动屏幕等). - 渲染后的资产被缓存到磁盘上. 重建运行时间为~40m. ~
安装
npm install --save-dev @darkobits/vite-plugin-favicons
使用
插件接受一个 FaviconOptions 用于对象
配置 favicons,但有下列差异:
import { defineConfig } from 'vite';
import { faviconsPlugin } from '@darkobits/vite-plugin-favicons';
export default defineConfig(() => ({
plugins: [
faviconsPlugin({
/**
* Whether to inject the HTML fragments generated by `favicons` into the
* compilation's HTML document.
*
* @default `true`
*/
inject: true,
/**
* Whether to cache generated assets for faster rebuilds.
*
* @default `true`
*/
cache: true,
// Any additional `favicons` configuration options may be used here.
/**
* Specify each icon type to render. Unlike `favicons`, this plugin is
* opt-in, meaning only the icon types you declare here will be rendered.
*
* For each icon type, all `favicons` options are supported. An
* additional `source` property is required to indicate the asset to be
* used for that icon type.
*/
icons: {
favicons: {
source: './assets/favicon.png'
},
android: {
source: './assets/android.png'
},
appleStartup: {
source: './assets/apple-startup.png'
}
// ...etc.
}
})
]
}));
上一个艺术