该插件通过加入 PurgeIcons 对 SVG 的 Tree Shaking 支持来仅获取您使用的 SVG,这样可以减小构建体积,提高首次加载速度,并且不会让浏览器下载用不到的文件,因此可以提升使用网站的用户体验。 在项目中使用 vite-plugin-purge-icons,你只需要在模板中使用 SVG 名称,purge-icons 会在打包过程中自动识别你使用的 SVG,...
vite-plugin-purge-icons Vite Plugin forPurgeIcons Usage ℹ️Vite 2 is supported fromv0.5.x, Vite 1's support is discontinued. Install npm i @iconify/iconify npm i vite-plugin-purge-icons @iconify/json -D @iconify/jsonis an optional dependencies of PurgeIcons. When it presents in your...
Vite plugin to remove unused Bootstrap Icons from your bundle. Latest version: 1.0.5, last published: a year ago. Start using vite-plugin-purge-bootstrap-icons in your project by running `npm i vite-plugin-purge-bootstrap-icons`. There are no other proje
import vueJsx from '@vitejs/plugin-vue-jsx'; // JSX语法编写组件 import legacy from '@vitejs/plugin-legacy'; // 使用它来提供对旧版本浏览器的支持 import purgeIcons from 'vite-plugin-purge-icons'; // 便高效的使用Iconify中所有的图标 import windiCSS from 'vite-plugin-windicss'; // wind...
// vite.config.js import PurgeIcons from 'vite-plugin-purge-icons' export default { plugins: [ PurgeIcons({ /* PurgeIcons Options */ }) ] } Import @purge-icons/generated in your main.jsimport { createApp } from 'vue' import App from './App.vue' import '@purge-icons/generated' /...
"vite-plugin-purge-icons": "workspace:*" }, "version": "0.5.0" } 2 changes: 2 additions & 0 deletions 2 examples/vite/vite.config.js Original file line numberDiff line numberDiff line change @@ -1,7 +1,9 @@ import PurgeIcons from 'vite-plugin-purge-icons' import Vue from '@...
Make sure you have Bootstrap Icons installed in your project. Then, import it in your css or scss. Next, install the plugin: npm i -D vite-plugin-purge-bootstrap-icons Then, add it to your vite.config.js: import purgeBootstrapIcons from 'vite-plugin-purge-bootstrap-icons' ... export...
// vite.config.jsimportPurgeIconsfrom'vite-plugin-purge-icons'exportdefault{plugins:[PurgeIcons({/* PurgeIcons Options */})]} main.js 代码语言:javascript 复制 import{createApp}from'vue'importAppfrom'./App.vue'import'@purge-icons/generated'// <-- ThiscreateApp(App).mount('#app') ...
VueI18nPlugin({ runtimeOnly: true, compositionOnly: true, include: [resolve(__dirname, 'src/locales/**')] }), createSvgIconsPlugin({ iconDirs: [pathResolve('src/assets/svgs')], symbolId: 'icon-[dir]-[name]', svgoOptions: true }), PurgeIcons(), viteMockServe({...
vite-plugin-svg-icons@1.0.4 配置文件 // vite.config.ts plugins: [ viteSvgIcons({ iconDirs: [resolve(process.cwd(), 'src/assets/icons')], symbolId: 'icon-[dir]-[name]', }), ] 复制代码 在main.ts 中引入 import 'virtual:svg-icons-register'; ...