{"id":27952032,"url":"https://github.com/swup/body-class-plugin","last_synced_at":"2025-05-07T16:27:22.471Z","repository":{"id":34881890,"uuid":"186147039","full_name":"swup/body-class-plugin","owner":"swup","description":"A swup plugin for updating the body classname 🎊","archived":false,"fork":false,"pushed_at":"2025-02-12T06:06:56.000Z","size":542,"stargazers_count":4,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T12:49:03.866Z","etag":null,"topics":["body","classname","plugin","swup"],"latest_commit_sha":null,"homepage":"https://swup.js.org/plugins/body-class-plugin","language":"TypeScript","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/swup.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["gmrchk","daun","hirasso"],"open_collective":"swup"}},"created_at":"2019-05-11T15:04:02.000Z","updated_at":"2025-02-12T06:06:53.000Z","dependencies_parsed_at":"2025-02-12T07:21:35.548Z","dependency_job_id":null,"html_url":"https://github.com/swup/body-class-plugin","commit_stats":{"total_commits":53,"total_committers":5,"mean_commits":10.6,"dds":"0.39622641509433965","last_synced_commit":"e03cbf30eed440f36a63f5d584c3542114612f84"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swup%2Fbody-class-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swup%2Fbody-class-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swup%2Fbody-class-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swup%2Fbody-class-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swup","download_url":"https://codeload.github.com/swup/body-class-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252914668,"owners_count":21824415,"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":["body","classname","plugin","swup"],"created_at":"2025-05-07T16:27:21.677Z","updated_at":"2025-05-07T16:27:22.461Z","avatar_url":"https://github.com/swup.png","language":"TypeScript","funding_links":["https://github.com/sponsors/gmrchk","https://github.com/sponsors/daun","https://github.com/sponsors/hirasso","https://opencollective.com/swup"],"categories":[],"sub_categories":[],"readme":"# Swup Body Class Plugin\n\nA [swup](https://swup.js.org) plugin for updating the body classname after each page load.\n\n## Installation\n\nInstall the plugin from npm and import it into your bundle.\n\n```bash\nnpm install @swup/body-class-plugin\n```\n\n```js\nimport SwupBodyClassPlugin from '@swup/body-class-plugin';\n```\n\nOr include the minified production file from a CDN:\n\n```html\n\u003cscript src=\"https://unpkg.com/@swup/body-class-plugin@3\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nTo run this plugin, include an instance in the swup options.\n\n```javascript\nconst swup = new Swup({\n  plugins: [new SwupBodyClassPlugin()]\n});\n```\n\n## Options\n\n### prefix\n\nBy default, all classes are updated. If your site uses classes on the body element for functionality\nlike opening menus, you can tell the plugin to only update classnames starting with a prefix,\ne.g. `page-`. It will then only update those classes and leave all other classes untouched.\n\n```javascript\n{\n  prefix: 'page-'\n}\n```\n\n### attributes\n\nUpdate additional attributes of the body element. Useful if you have defined the `lang` or `dir`\nattributes or work with `data-*` attributes on the body element. Accepts an array of strings or\nregular expression instances.\n\n```javascript\n{\n  attributes: ['lang', 'dir', /^data-/]\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswup%2Fbody-class-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswup%2Fbody-class-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswup%2Fbody-class-plugin/lists"}