{"id":21989072,"url":"https://github.com/imweb/fis-postpackager-iconfont","last_synced_at":"2026-04-20T10:02:47.431Z","repository":{"id":35833858,"uuid":"40116952","full_name":"imweb/fis-postpackager-iconfont","owner":"imweb","description":"iconfont","archived":false,"fork":false,"pushed_at":"2016-03-25T07:42:05.000Z","size":6599,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T02:44:40.004Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-03T09:38:19.000Z","updated_at":"2017-11-16T02:15:05.000Z","dependencies_parsed_at":"2022-09-08T17:30:07.706Z","dependency_job_id":null,"html_url":"https://github.com/imweb/fis-postpackager-iconfont","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/imweb/fis-postpackager-iconfont","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Ffis-postpackager-iconfont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Ffis-postpackager-iconfont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Ffis-postpackager-iconfont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Ffis-postpackager-iconfont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imweb","download_url":"https://codeload.github.com/imweb/fis-postpackager-iconfont/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imweb%2Ffis-postpackager-iconfont/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32042293,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-29T19:27:37.780Z","updated_at":"2026-04-20T10:02:47.414Z","avatar_url":"https://github.com/imweb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fis-postpackager-iconfont\n**兼容fis3**\n\n\n\n### 安装\n```\nnpm install fis-postpackager-iconfont -g\n\n```\n\n\n### 背景\n\n项目中使用iconfont时，需要将 SVG 转化成 font 字体文件，同时解决字体css的引入的问题，整个流程比较繁琐。\n\n\n### 目标\n在 html 标签上挂载和 svg 同名（或者有映射关系）的类名，构建解决：\n+ SVG 转化 字体文件\n+ css 的引入问题\n通过上面的方式，可以使`iconfont 的使用对开发透明` 。\n最终生成的字体存放在一个可配置的目录下，同时字体的css引入直接插入到html中, 在html中使用 `\u003c!--ICONFONT_PLACEHOLDER--\u003e`，占位符指明最终css的插入位置，如未执行，则会插入在  `\u003c/head\u003e之前`\n\n### 使用方式\n\n```\n// settings\npostpackager: fis.plugin('iconfont', {\n    //可选，遍历js时，可以忽略的基础库\n    ignore: ['zepto', 'badjs', 'mod', 'bj-report', 'tools', 'db.js'],\n    //可选，匹配的icon前缀，即类名是i-xxx, optional, 默认是 i-\n    classPrefix: 'i-',\n    // 本地svg路径，方便生成字体文件，这里可以使用脚本同步iconfont平台上的svg\n    // 默认指向 fis3-postpackager-iconfont 安装目录下的svgs文件夹\n    //（安装插件是，自动执行脚本，同步iconfont.imweb.io平台上的svg文件）,\n    // 若fis3-postpackager-iconfont安装目录下的svgs目录中有svg，这里可以不需要配置；\n    // 否者，需要手动同步svg到项目目录，然后配置svgPath\n    svgPath: '../svgs',\n    // 必须，字体的产出路径\n    output: 'modules/common/fonts',\n    //可选， css 是否inline到页面, 默认已link方式引入\n    cssInline: true,\n    //可选， 字体content使用的伪类，只能填after或者before，默认为after\n    pseClass: 'before', \n    // h5里面可以将ttf文件base64引入\n    base64: false,\n    ignoreSrc: [], // glob 表达式，指定哪些文件不需要遍历，在引用组件时，有可能组件本身已经处理了iconfont。\n\tnonBaseCss: true // 不导入iconfont基础css样式，默认值为false，一般不需要设置\n})\n\n// 最简配置\npostpackager: fis.plugin('iconfont', {\n    svgPath: '../svgs',\n    output: 'modules/common/fonts'\n})\n\n```\n\n##### fis2 配置\n```\nfis.config.merge({\n    modules: {\n        postpackager: ['iconfont']\n    }\n});\nfis.config.merge({\n    settings: {\n        postpackager: {\n            iconfont: {\n                // 配置同上\n               output: 'modules/common/fonts' \n            }\n        }\n    }\n});\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Ffis-postpackager-iconfont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimweb%2Ffis-postpackager-iconfont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimweb%2Ffis-postpackager-iconfont/lists"}