🔣 Auto minify font in build.
npm i unplugin-fontmin
Vite
// vite.config.ts
import Fontmin from 'unplugin-fontmin/vite'
export default defineConfig({
plugins: [
Fontmin({ /* options */ }),
],
})
Example: playground/
Rollup
// rollup.config.js
import Fontmin from 'unplugin-fontmin/rollup'
export default {
plugins: [
Fontmin({ /* options */ }),
],
}
Webpack
// webpack.config.js
module.exports = {
/* ... */
plugins: [
require('unplugin-fontmin/webpack')({ /* options */ })
]
}
Nuxt
// nuxt.config.js
export default defineNuxtConfig({
modules: [
['unplugin-fontmin/nuxt', { /* options */ }],
],
})
This module works for both Nuxt 2 and Nuxt Vite
Vue CLI
// vue.config.js
module.exports = {
configureWebpack: {
plugins: [
require('unplugin-fontmin/webpack')({ /* options */ }),
],
},
}
esbuild
// esbuild.config.js
import { build } from 'esbuild'
import Fontmin from 'unplugin-fontmin/esbuild'
build({
plugins: [Fontmin()],
})