{"id":35538938,"url":"https://github.com/chris-ware/bem-twig-extension","last_synced_at":"2026-01-04T04:01:11.641Z","repository":{"id":56952284,"uuid":"116008737","full_name":"chris-ware/bem-twig-extension","owner":"chris-ware","description":"BEM Twig Extension","archived":false,"fork":false,"pushed_at":"2018-01-02T11:51:29.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T14:47:24.437Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/chris-ware.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":"2018-01-02T11:34:31.000Z","updated_at":"2020-04-09T14:22:20.000Z","dependencies_parsed_at":"2022-08-21T09:20:16.237Z","dependency_job_id":null,"html_url":"https://github.com/chris-ware/bem-twig-extension","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/chris-ware/bem-twig-extension","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-ware%2Fbem-twig-extension","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-ware%2Fbem-twig-extension/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-ware%2Fbem-twig-extension/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-ware%2Fbem-twig-extension/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chris-ware","download_url":"https://codeload.github.com/chris-ware/bem-twig-extension/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chris-ware%2Fbem-twig-extension/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28197442,"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","status":"online","status_checked_at":"2026-01-04T02:00:06.065Z","response_time":58,"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":"2026-01-04T04:00:42.901Z","updated_at":"2026-01-04T04:01:11.623Z","avatar_url":"https://github.com/chris-ware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bem-twig-extension\nTwig function that inserts static classes in BEM methodology.\n\nBased on [https://github.com/drupal-pattern-lab/bem-twig-extension], but adapted to be available as a normal twig extension\n\n## Add Extension\n\n```php\n$twig = new Twig_Environment($loader, $options);\n$twig-\u003eaddExtension(new Bem\\Twig\\BemExtension());\n```\n\n## Usage (4 arguments)\n\n#### Simple block name (required argument):\n`\u003ch1 {{ bem('title') }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"title\"\u003e`\n\n#### Block with modifiers (optional array allowing multiple modifiers):\n`\u003ch1 {{ bem('title', ['small', 'red']) }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"title title--small title--red\"\u003e`\n\n#### Element with modifiers and blockname (optional):\n`\u003ch1 {{ bem('title', ['small', 'red'], 'card') }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"card__title card__title--small card__title--red\"\u003e`\n\n#### Element with blockname, but no modifiers (optional):\n\n`\u003ch1 {{ bem('title', '', 'card') }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"card__title\"\u003e`\n\n#### Element with modifiers, blockname and extra classes (optional - in case you need non-BEM classes):\n\n`\u003ch1 {{ bem('title', ['small', 'red'], 'card', ['js-click', 'something-else']) }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"card__title card__title--small card__title--red js-click something-else\"\u003e`\n\n#### Element with extra classes only (optional):\n\n`\u003ch1 {{ bem('title', '', '', ['js-click']) }}\u003e`\n\nThis creates:\n\n`\u003ch1 class=\"title js-click\"\u003e`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-ware%2Fbem-twig-extension","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchris-ware%2Fbem-twig-extension","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchris-ware%2Fbem-twig-extension/lists"}