{"id":21240243,"url":"https://github.com/retyui/postcss-icon","last_synced_at":"2025-07-10T19:33:06.924Z","repository":{"id":57328082,"uuid":"111441292","full_name":"retyui/postcss-icon","owner":"retyui","description":"PostCSS plugin that adds `css icons` from icon sets","archived":false,"fork":false,"pushed_at":"2022-10-16T10:06:43.000Z","size":399,"stargazers_count":22,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-09-24T08:34:49.408Z","etag":null,"topics":["postcss","postcss-plugin"],"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/retyui.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-11-20T17:25:52.000Z","updated_at":"2022-10-16T10:06:47.000Z","dependencies_parsed_at":"2022-09-18T10:20:21.030Z","dependency_job_id":null,"html_url":"https://github.com/retyui/postcss-icon","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/retyui%2Fpostcss-icon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retyui%2Fpostcss-icon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retyui%2Fpostcss-icon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/retyui%2Fpostcss-icon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/retyui","download_url":"https://codeload.github.com/retyui/postcss-icon/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225073065,"owners_count":17416536,"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":["postcss","postcss-plugin"],"created_at":"2024-11-21T00:50:03.603Z","updated_at":"2024-11-21T00:50:04.201Z","avatar_url":"https://github.com/retyui.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-icon\n\n![postcss-icon](https://raw.githubusercontent.com/retyui/postcss-icon/master/logo.png)\n\n[![npm](https://img.shields.io/npm/v/postcss-icon.svg)](https://www.npmjs.com/package/postcss-icon)\n[![npm download count postcss-icon](https://img.shields.io/npm/dm/postcss-icon.svg)](https://www.npmjs.com/package/postcss-icon)\n[![AppVeyor](https://img.shields.io/appveyor/ci/retyui/postcss-icon.svg?label=windows)](https://ci.appveyor.com/project/retyui/postcss-icon)\n[![Travis](https://img.shields.io/travis/retyui/postcss-icon.svg?label=unix)](https://travis-ci.org/retyui/postcss-icon)\n\nPostCSS plugin that adds `css icons` from Icon sets\n\nNow you do not need to connect the entire style library for css icons.\n\n## Ison sets:\n\n### Font icons:\n\n- [![npm download count postcss-icon.material-design](https://img.shields.io/npm/dm/postcss-icon.material-design.svg)](https://www.npmjs.com/package/postcss-icon.material-design) [postcss-icon.material-design](https://github.com/retyui/postcss-icon.material-design) (count icons : 932) [result demo](https://retyui.github.io/postcss-icon/material-design/)\n- [![npm download count postcss-icon.font-awesome-v4](https://img.shields.io/npm/dm/postcss-icon.font-awesome-v4.svg)](https://www.npmjs.com/package/postcss-icon.font-awesome-v4) [postcss-icon.font-awesome-v4](https://github.com/retyui/postcss-icon.font-awesome-v4) (count icons : 786) [result demo](https://retyui.github.io/postcss-icon/font-awesome-v4/)\n\n### Css only icons:\n\n- [![npm download count postcss-icon.cssicon](https://img.shields.io/npm/dm/postcss-icon.cssicon.svg)](https://www.npmjs.com/package/postcss-icon.cssicon) [postcss-icon.cssicon](https://github.com/retyui/postcss-icon.cssicon) (count icons : 192) [result demo](https://retyui.github.io/postcss-icon/cssicon/)\n- [![npm download count postcss-icon.icono](https://img.shields.io/npm/dm/postcss-icon.icono.svg)](https://www.npmjs.com/package/postcss-icon.icono) [postcss-icon.icono](https://github.com/retyui/postcss-icon.icono) (count icons : 131) [result demo](https://retyui.github.io/postcss-icon/icono/)\n- [![npm download count postcss-icon.rosa](https://img.shields.io/npm/dm/postcss-icon.rosa.svg)](https://www.npmjs.com/package/postcss-icon.rosa) [postcss-icon.rosa](https://github.com/retyui/postcss-icon.rosa) (count icons : 78) [result demo](https://retyui.github.io/postcss-icon/rosa/)\n- [![npm download count postcss-icon.airpwn](https://img.shields.io/npm/dm/postcss-icon.airpwn.svg)](https://www.npmjs.com/package/postcss-icon.airpwn) [postcss-icon.airpwn](https://github.com/retyui/postcss-icon.airpwn) (count icons : 39) [result demo](https://retyui.github.io/postcss-icon/airpwn/)\n- [![npm download count postcss-icon.stiffi](https://img.shields.io/npm/dm/postcss-icon.stiffi.svg)](https://www.npmjs.com/package/postcss-icon.stiffi) [postcss-icon.stiffi](https://github.com/retyui/postcss-icon.stiffi) (count icons : 34) [result demo](https://retyui.github.io/postcss-icon/stiffi/)\n- [![npm download count postcss-icon.joshnh](https://img.shields.io/npm/dm/postcss-icon.joshnh.svg)](https://www.npmjs.com/package/postcss-icon.joshnh) [postcss-icon.joshnh](https://github.com/retyui/postcss-icon.joshnh) (count icons : 24) [result demo](https://retyui.github.io/postcss-icon/joshnh/)\n\n## Install for postcss\n\n```bash\n# the plugin\nyarn add postcss-icon\n\n# and the icon set you need\nyarn add postcss-icon.material-design\nyarn add postcss-icon.font-awesome-v4\nyarn add postcss-icon.cssicon\nyarn add postcss-icon.icono\nyarn add postcss-icon.rosa\nyarn add postcss-icon.airpwn\nyarn add postcss-icon.stiffi\nyarn add postcss-icon.joshnh\n```\n\n## Input:\n\n```css\n.icon.bad-name {\n  @icon: 404-not-found-name;\n}\n.icon {\n  color: gold;\n  @icon: prefix-name;\n}\n```\n\n## Output:\n\n```css\n@font-face {\n  /*  */\n} /* added if you use font icon set */\n\n.icon.bad-name {\n  /* @icon: 404-not-found-name */\n}\n.icon::after {\n  content: \"\";\n  /* ... */\n}\n/* after  before  i  span */\n.icon {\n  color: #000;\n  width: 20px;\n  heigth: 20px;\n  /* ... */\n  color: gold;\n}\n```\n\n## Usage ([more examples](https://github.com/retyui/postcss-icon/tree/master/example/))\n\n```js\nconst { resolve } = require(\"path\");\nconst postcss = require(\"postcss\");\nconst postcssIcon = require(\"postcss-icon\");\n\nconst fontSetOptions = {\n  inline: [\"woff2\"],\n  path: resolve(__dirname, \"./public/assets/fonts/\"), // folder to save all font files. Required absolute path!\n  formats: [\"woff2\", \"woff\" /*, \"ttf\", \"svg\", \"eot\"*/],\n  filename: \"[css-name]-[set-name].[hash:4].[ext]\",\n  url({ cssFile, fontName, hash }) {\n    // function help fix url resolve\n    // const urlWithQueryHash = `../fonts/${fontName}?v=${hash.substr(0, 5)}`;\n    // const exmapleResolveUrl = `../fonts/${fontName}`;\n    return fontName;\n  }\n};\n// example for all icon Set\npostcss(\n  postcssIcon({\n    \"postcss-icon.material-design\": {\n      ...fontSetOptions,\n      prefix: \"md-\"\n    },\n    \"postcss-icon.font-awesome-v4\": {\n      ...fontSetOptions,\n      prefix: \"fa-\"\n    },\n    \"postcss-icon.cssicon\": { prefix: \"cssicon-\" },\n    \"postcss-icon.icono\": { prefix: \"icono-\" },\n    \"postcss-icon.rosa\": { prefix: \"rose-\" },\n    \"postcss-icon.airpwn\": { prefix: \"airpwn-\" },\n    \"postcss-icon.stiffi\": { prefix: \"stiffi-\" },\n    \"postcss-icon.joshnh\": { prefix: \"joshnh-\" }\n  })\n);\n```\n\n## Options\n\n## Formats Support table (2018-1-15):\n\n| Type                                       | Support |\n| ------------------------------------------ | ------- |\n| [woff2](https://caniuse.com/#feat=woff2)   | 96.93%  |\n| [woff](https://caniuse.com/#feat=woff)     | 98.48%  |\n| [ttf](https://caniuse.com/#feat=ttf)       | 98.63%  |\n| [svg](https://caniuse.com/#feat=svg-fonts) | 19.25%  |\n| [eot](https://caniuse.com/#feat=eot)       | 0.62%   |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretyui%2Fpostcss-icon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fretyui%2Fpostcss-icon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fretyui%2Fpostcss-icon/lists"}