{"id":15385032,"url":"https://github.com/manekinekko/angular-twig","last_synced_at":"2025-06-28T10:36:07.353Z","repository":{"id":143759257,"uuid":"51874369","full_name":"manekinekko/angular-twig","owner":"manekinekko","description":"Twig template engine support for Angular","archived":false,"fork":false,"pushed_at":"2018-02-02T16:46:48.000Z","size":8,"stargazers_count":7,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-16T04:14:13.792Z","etag":null,"topics":["angular","decorators","template-engine","twig","twig-templates"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/manekinekko.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-16T22:14:20.000Z","updated_at":"2018-04-28T14:11:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec3e7e89-4f7d-4ff3-969f-61ccf5da1e96","html_url":"https://github.com/manekinekko/angular-twig","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manekinekko/angular-twig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manekinekko%2Fangular-twig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manekinekko%2Fangular-twig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manekinekko%2Fangular-twig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manekinekko%2Fangular-twig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manekinekko","download_url":"https://codeload.github.com/manekinekko/angular-twig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manekinekko%2Fangular-twig/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260809979,"owners_count":23066635,"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":["angular","decorators","template-engine","twig","twig-templates"],"created_at":"2024-10-01T14:43:52.505Z","updated_at":"2025-06-28T10:36:07.297Z","avatar_url":"https://github.com/manekinekko.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Angular2 \u0026#9829; Twig\n\nThis (WIP...) experiment is an attempt to add Twig templating support for Angular v2+\n\n### Install\n\n```\nyarn add @manekinekko/angular-twig\n```\n\nor \n\n```\nnpm i -S @manekinekko/angular-twig\n```\n\n### Setup with Angular-cli\n\nImport the `twig` library into your `.angular-cli.json` file:\n\n```json\n\"scripts\": [\n\t\t\"../node_modules/twig/twig.min.js\"\n\t],\n```\n\n### How to use\n\n```javascript\nimport { Twig } from '@manekinekko/angular-twig';\n```\n\nThe `@Twig` decorator supersedes the `@Component()` decorator. **Don't use both!**\n\n#### Use a `templateUrl`\n\n```javascript\n@Twig({\n\ttemplateUrl: 'templates/field--comment.html.twig',\n  // -or- template: '',\n\tcontext: {\n\t\ttitle: 'Angular2 ❤ Twig',\n\t\tcontent_1: 'content 1',\n\t\tcontent_2: 'content 2'\n\t},\n\tselector: '#block-content',\n})\nexport class AppComponent {}\n```\n#### Use an inlined `template`\n\n```javascript\n@Twig({\n  template: `\n  \u003csection\u003e\n    {% if title %}\n      \u003ch2\u003e{{ title }}\u003c/h2\u003e\n    {% endif %}\n\n    {{ content_1 }}\n\n    {% if content_2 %}\n      {{ content_2 }}\n    {% endif %}\n  \u003c/section\u003e\n  `,\n\tcontext: {\n\t\ttitle: 'Angular2 ❤ Twig',\n\t\tcontent_1: 'content 1',\n\t\tcontent_2: 'content 2'\n\t},\n\tselector: '#block-content',\n})\nexport class AppComponent {}\n```\n\n### Live Example\n\nCheckout this [plnkr](http://plnkr.co/edit/K0MohmywZpn5aSVHtYad?p=preview) for a quick demo.\n\n### Acknowledgments\n\nThe Twig templates are parsed using (a modified version of) the  [twig.js](https://github.com/justjohn/twig.js) library from [@justjohn](https://github.com/justjohn). All credits go to him for the parser.\n\n### License\nThe MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanekinekko%2Fangular-twig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanekinekko%2Fangular-twig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanekinekko%2Fangular-twig/lists"}