{"id":18023997,"url":"https://github.com/lete114/rollup-plugin-font-minify","last_synced_at":"2025-04-04T18:27:40.106Z","repository":{"id":215255731,"uuid":"738508505","full_name":"Lete114/rollup-plugin-font-minify","owner":"Lete114","description":"Remove unused font glyphs from the project during packaging to reduce font file size","archived":false,"fork":false,"pushed_at":"2024-05-01T13:26:57.000Z","size":7008,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-10T16:48:53.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Lete114.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-03T11:44:44.000Z","updated_at":"2024-05-01T13:27:01.000Z","dependencies_parsed_at":"2024-10-30T07:46:46.613Z","dependency_job_id":null,"html_url":"https://github.com/Lete114/rollup-plugin-font-minify","commit_stats":null,"previous_names":["lete114/rollup-plugin-fontmin","lete114/rollup-plugin-font-minify"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Frollup-plugin-font-minify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Frollup-plugin-font-minify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Frollup-plugin-font-minify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Lete114%2Frollup-plugin-font-minify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Lete114","download_url":"https://codeload.github.com/Lete114/rollup-plugin-font-minify/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247228234,"owners_count":20904831,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T07:11:38.243Z","updated_at":"2025-04-04T18:27:40.076Z","avatar_url":"https://github.com/Lete114.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rollup-plugin-font-minify\n\nRemove unused font glyphs from the project during packaging to reduce font file size\n\n## Install\n\nUsing npm:\n\n```bash\nnpm install rollup-plugin-font-minify --save-dev\n```\n\n## Usage\n\nIf you are using [rollup](https://www.rollupjs.org)\n\nCreate a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin:\n\n```js\n// rollup.config.js\nimport fontmin from 'rollup-plugin-font-minify'\n\nexport default {\n  input: 'src/index.js',\n  output: {\n    // ...\n  },\n  plugins: [fontmin()]\n}\n```\n\nIf you are using [vite](https://vitejs.dev)\n\nCreate a `vite.config.js` [configuration file](https://vitejs.dev/config/) and import the plugin:\n\n```js\n// vite.config.js\nimport fontmin from 'rollup-plugin-font-minify'\n\nexport default {\n  plugins: [fontmin()]\n}\n```\n\n## Options\n\n### `reserveText`\n\nType: `String`\u003cbr\u003e\nDefault: `''`\n\nText to be reserved.\u003cbr\u003e\nThis option can be used in certain scenarios where data obtained by sending a request needs to be displayed on the page and fonts are used.\u003cbr\u003e\nThe reserved font glyphs you specify will be retained during packaging.\n\n### `filter`\n\nType: `(text: string) =\u003e string`\u003cbr\u003e\nDefault: `null`\n\nFilter text to keep only what is needed\n\nThis is an example: compress only specified characters, e.g. only [CJK](https://wikipedia.org/wiki/CJK_characters) (CJK Unified Ideographs) characters\n\n```js\nfunction getCJK(str) {\n  const reg = /[\\u4E00-\\u9FA5\\u3040-\\u30FF\\u31F0-\\u31FF\\uFF00-\\uFF9F\\u3000-\\u303F\\uFF01-\\uFF0F\\uFF1A-\\uFF20\\uFF3B-\\uFF40\\uFF5B-\\uFF60\\uFFE0-\\uFFE6]/g\n  const cjkChars = str.match(reg)\n  return cjkChars ? cjkChars.join('') : ''\n}\n\nplugins: [\n  fontmin({\n    filter(text) {\n      return getCJK(text)\n    }\n  })\n]\n```\n\n## Meta\n\n[LICENSE (MIT)](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Frollup-plugin-font-minify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flete114%2Frollup-plugin-font-minify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flete114%2Frollup-plugin-font-minify/lists"}