A rollup plugin to minify font. based on Fontmin.
npm install -D @higuaifan/rollup-plugin-fontmin
import { RollupPluginFontmin } from '@higuaifan/rollup-plugin-fontmin';
// config
{
build:{
rollupOptions:{
plugins:[
RollupPluginFontmin()
]
}
}
}
import { defineNuxtModule } from "@nuxt/kit";
import { fileScanAndFontmin } from '@higuaifan/rollup-plugin-fontmin';
export default defineNuxtModule({
async setup(options, nuxt) {
nuxt.hook('close', async () => {
await fileScanAndFontmin({});
});
}
})
key | type | description | default |
---|---|---|---|
fontSrc | string | needs minify fonts file src | './public/font/*.*' |
fontDest | string | minified fonts output file src | './dist/font' |
include | string[] or string | scan folders or files based on fast-glob | 'src/**/*' |
fileExt | string[] or string | scan files extension list | 'ts', 'js', 'tsx', 'jsx', 'vue', 'scss', 'sass', 'html', 'json' |
exclude | string[] or string | exclude folders or files | '' |
- ignore annotate
- support all Fontmin api
- make code strong