{"id":18300334,"url":"https://github.com/jpdevries/twag","last_synced_at":"2026-01-21T02:32:54.796Z","repository":{"id":140005847,"uuid":"67257501","full_name":"jpdevries/Twag","owner":"jpdevries","description":"HTML tags in Twig","archived":false,"fork":false,"pushed_at":"2016-11-13T12:47:39.000Z","size":43,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-09T09:35:03.272Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/jpdevries.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-09-02T21:56:42.000Z","updated_at":"2016-09-02T22:05:48.000Z","dependencies_parsed_at":"2023-05-01T03:47:34.973Z","dependency_job_id":null,"html_url":"https://github.com/jpdevries/Twag","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jpdevries/Twag","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2FTwag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2FTwag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2FTwag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2FTwag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpdevries","download_url":"https://codeload.github.com/jpdevries/Twag/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpdevries%2FTwag/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28623283,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"online","status_checked_at":"2026-01-21T02:00:08.227Z","response_time":86,"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-05T15:12:03.993Z","updated_at":"2026-01-21T02:32:54.780Z","avatar_url":"https://github.com/jpdevries.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Twag\n\nHTML tags in Twig.\n\nTwag is a collection of Twig imports each of which represent an HTML tag and its associated\u0026nbsp;attributes.\n\n## Usage\nTwag templates work the same as any other Twig template. Include the Twag template for the tag you'd like to use and pass in any optional\u0026nbsp;attributes.\n```twig\n{% include 'twag/img.twig' with {\n  'alt': 'A picture of a cat',\n  'src': 'cat.jpg'\n  } only %}\n```\n\n```html\n\u003cimg alt=\"A picture of a cat\" src=\"cat.jpg\"\u003e\n```\n\nTags that represent non\u0026ndash;void elements can be included with the [Twig embed syntax](http://twig.sensiolabs.org/doc/tags/embed.html) and accept an `innerHTML`\u0026nbsp;block.\n\n```twig\n{% embed \"twag/label.twig\" with {\n  'for': 'cat'\n} only %}\n  {% block innerHTML %}\n    A cool cat\n  {% endblock %}\n{% endembed %}\n```\n\n```html\n\u003clabel for=\"cat\"\u003eA cool cat\u003c/label\u003e\n```\n\nWhat about miscellaneous attributes like `ARIA` and `data-attributes`? Pass a [Key Value](https://mijingo.com/blog/key-value-arrays-in-twig) array as a `misc` property to append those attributes as\u0026nbsp;well.\n\n```twig\n{% include 'twag/img.twig' with {\n  'alt': 'A picture of a cat',\n  'src': 'cat.jpg',\n  'misc': {\n    'aria-hidden': 'false',\n    'data-meow': 'true'\n  }\n} only %}\n```\n\n```html\n\u003cimg alt=\"A picture of a cat\" src=\"cat.jpg\" aria-hidden=\"false\" data-meow=\"true\"\u003e\n```\n\nMiscellaneous attributes such as `hidden` that have no value are supported as\u0026nbsp;well.\n\n```twig\n{% include 'twag/img.twig' with {\n  'alt': 'A picture of a hidden cat',\n  'src': 'cat.jpg',\n  'misc': {\n    'aria-hidden': 'true',\n    'hidden': ''\n  }\n} only %}\n```\n\n```html\n\u003cimg alt=\"A picture of a hidden cat\" src=\"cat.jpg\" aria-hidden=\"true\" hidden\u003e\n```\n\n## To Do\n - [Package with Composer?](https://github.com/jpdevries/Twag/issues/1)\n - Port Build to PHP?\n\n## Contributing\nContributions are welcome. In the `_build` folder you'll find a `build.js` script and an accompanying `attributes` directory. There is a JSON file representing each HTML tag in the `attributes` folder that contains the attributes available for that\u0026nbsp;tag.\n\nTo add a new tag, add the corresponding JSON file to the attributes folder. To update the attributes for a tag update the existing JSON file. Lastly, run the `build`\u0026nbsp;script.\n\n```bash\ncd twag\nnpm install # if you haven't already\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpdevries%2Ftwag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpdevries%2Ftwag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpdevries%2Ftwag/lists"}