{"id":15638746,"url":"https://github.com/zachleat/postcss-foft-classes","last_synced_at":"2025-04-14T03:15:27.606Z","repository":{"id":53756626,"uuid":"107127323","full_name":"zachleat/postcss-foft-classes","owner":"zachleat","description":"A postcss plugin to automatically add classes for various font loading strategies.","archived":false,"fork":false,"pushed_at":"2021-03-15T21:08:36.000Z","size":16,"stargazers_count":90,"open_issues_count":3,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T03:15:20.844Z","etag":null,"topics":["font","postcss","web-font"],"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/zachleat.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":"2017-10-16T12:55:31.000Z","updated_at":"2024-05-30T07:28:08.000Z","dependencies_parsed_at":"2022-09-18T17:50:19.540Z","dependency_job_id":null,"html_url":"https://github.com/zachleat/postcss-foft-classes","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fpostcss-foft-classes","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fpostcss-foft-classes/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fpostcss-foft-classes/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zachleat%2Fpostcss-foft-classes/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zachleat","download_url":"https://codeload.github.com/zachleat/postcss-foft-classes/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248813803,"owners_count":21165634,"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","postcss","web-font"],"created_at":"2024-10-03T11:22:58.527Z","updated_at":"2025-04-14T03:15:27.579Z","avatar_url":"https://github.com/zachleat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# postcss-foft-classes\n\nA postcss plugin to automatically add classes for various [font loading strategies](https://www.zachleat.com/web/comprehensive-webfonts/). Based heavily on [`netlify/postcss-fout-with-a-class`](https://github.com/netlify/postcss-fout-with-a-class).\n\nDocumentation currently only has Gulp config examples but is open to contributions with other build tool configurations! This works anywhere postcss does.\n\n## Installation\n\n`npm install postcss-foft-classes`\n\n## Sample: FOUT, Single Stage\n\nSee the [full FOUT with a Class example code](https://github.com/zachleat/web-font-loading-recipes/blob/master/fout-with-class.html), with font faces and the JavaScript code that goes with it.\n\n### Gulp Config\n\nSee this working in `./gulp-test/`.\n\n```js\n.pipe(\n  postcss([\n    foftLoadedClasses({\n      groups: [\n        {\n          families: [\"Lato\"],\n          classNames: [\"fonts-loaded\"]\n        }\n      ]\n    })\n  ])\n)\n```\n\n### Input CSS\n\n```css\nbody {\n  font-family: Lato, sans-serif;\n}\n```\n\n### Output CSS\n\n```css\nbody {\n  font-family: sans-serif;\n}\n\n.fonts-loaded body {\n  font-family: Lato;\n}\n```\n\n## Sample: FOFT, Two Stages\n\nSee the [full FOFT example code](https://github.com/zachleat/web-font-loading-recipes/blob/master/foft.html), with font faces and the JavaScript code that goes with it.\n\n### Gulp Config\n\nSee this working in `./gulp-test/`.\n\n```js\n.pipe(\n  postcss([\n    foftLoadedClasses({\n      groups: [\n        {\n          families: [\"LatoInitial\", \"Lato\"],\n          classNames: [\"fonts-loaded\", \"fonts-loaded-2\"]\n        }\n      ]\n    })\n  ])\n)\n```\n\n### Input CSS\n\n```css\nbody {\n  font-family: Lato, sans-serif;\n}\n```\n\n### Output CSS\n\n```css\nbody {\n  font-family: sans-serif;\n}\n\n.fonts-loaded body {\n  font-family: LatoInitial;\n}\n\n.fonts-loaded-2 body {\n  font-family: Lato;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachleat%2Fpostcss-foft-classes","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzachleat%2Fpostcss-foft-classes","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzachleat%2Fpostcss-foft-classes/lists"}