{"id":24770277,"url":"https://github.com/tengfei5000nian/static-font-min-loader","last_synced_at":"2025-03-23T19:41:23.896Z","repository":{"id":59449181,"uuid":"537337639","full_name":"tengfei5000nian/static-font-min-loader","owner":"tengfei5000nian","description":"一个webpack的loader，用来压缩生成字体。","archived":false,"fork":false,"pushed_at":"2022-09-24T10:38:50.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-20T08:36:09.140Z","etag":null,"topics":["font","webpack","webpack-loader"],"latest_commit_sha":null,"homepage":"","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/tengfei5000nian.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}},"created_at":"2022-09-16T06:42:56.000Z","updated_at":"2023-02-03T04:48:01.000Z","dependencies_parsed_at":"2022-09-17T14:41:43.390Z","dependency_job_id":null,"html_url":"https://github.com/tengfei5000nian/static-font-min-loader","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengfei5000nian%2Fstatic-font-min-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengfei5000nian%2Fstatic-font-min-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengfei5000nian%2Fstatic-font-min-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tengfei5000nian%2Fstatic-font-min-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tengfei5000nian","download_url":"https://codeload.github.com/tengfei5000nian/static-font-min-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245161942,"owners_count":20570690,"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":["font","webpack","webpack-loader"],"created_at":"2025-01-29T03:03:57.530Z","updated_at":"2025-03-23T19:41:23.864Z","avatar_url":"https://github.com/tengfei5000nian.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fontmin loader for webpack\n\n一个webpack的loader，用来压缩生成字体。\n\n\u003e NOTE: Node v10+ and webpack v4+ are supported and tested.\n\n\n## 关于\n\n读取指定文件文本，使用fontmin压缩用到的字体。\n\n\n## 安装\n\n`npm install --save-dev static-font-min-loader`\n\n\n## 使用\n\n```js\nconst webpackConfig = {\n    module: {\n        rules: [\n            {\n                test: /\\.(otf|ttf|svg|svgs|eot|woff|woff2)(\\?.*)?$/,\n                type: 'javascript/auto',\n                loader: 'static-font-min-loader',\n                options: {\n                    fileLoaderOptions: {\n                        name: 'font/[name].[hash:8].[ext]'\n                    }\n                }\n            }\n        ]\n    }\n}\n\nmodule.exports = webpackConfig\n```\n\n```css\n@font-face {\n    font-family: 'source';\n    src:\n        url('../font/source.ttf?to=eot') format('embedded-opentype'),\n        url('../font/source.ttf?to=woff2') format('woff2'),\n        url('../font/source.ttf?to=woff') format('woff'),\n        url('../font/source.ttf?to=svg') format('svg'),\n        url('../font/source.ttf') format('truetype');\n}\n```\n\n在source.ttf的文件夹中创建source.txt文本文件，里面包含需要压缩的文字。\n\n\n## 选项\n\n```js\n{\n    // 包含需要切割的文本的文件, 如果include、exclude存在，links失效。\n    //\n    // type: array|string\n    // default: loaderContext.resourcePath.replace(/\\.([\\w\\d]+)$/, '.txt')\n    links: [],\n\n    // 包含的文件。\n    //\n    // type: RegExp?\n    include: null,\n\n    // 排除的文件\n    //\n    // type: RegExp?\n    exclude: null,\n\n    // 文本过滤。\n    //\n    // type: function(text: string): string\n    filter: text =\u003e text,\n\n    // file-loader的options。\n    // See https://github.com/webpack-contrib/file-loader\n    //\n    // type: object？\n    fileLoaderOptions: {}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftengfei5000nian%2Fstatic-font-min-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftengfei5000nian%2Fstatic-font-min-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftengfei5000nian%2Fstatic-font-min-loader/lists"}