@higuaifan/rollup-plugin-fontmin
v0.0.6
Published
A rollup plugin to minify font
Downloads
25
Readme
rollup-plugin-fontmin
A rollup plugin to minify font. based on Fontmin.
QUICK START
install
npm install -D @higuaifan/rollup-plugin-fontmin
usage
vite
import { RollupPluginFontmin } from '@higuaifan/rollup-plugin-fontmin';
// config
{
build:{
rollupOptions:{
plugins:[
RollupPluginFontmin()
]
}
}
}
nuxt
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({});
});
}
})
API
| 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 | '' |
TODO
- [ ] ignore annotate
- [ ] support all Fontmin api
- [ ] make code strong