{"id":20984727,"url":"https://github.com/prgfx/fusion-template-literals","last_synced_at":"2025-12-29T23:09:14.375Z","repository":{"id":57044670,"uuid":"214396198","full_name":"PRGfx/Fusion-Template-Literals","owner":"PRGfx","description":"A Neos fusion DSL providing a syntax similar to the javascript tagged template literals","archived":false,"fork":false,"pushed_at":"2020-01-05T10:08:40.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T07:14:37.586Z","etag":null,"topics":["neos-fusion","neoscms"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PRGfx.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":"2019-10-11T09:25:47.000Z","updated_at":"2020-01-05T10:05:39.000Z","dependencies_parsed_at":"2022-08-24T04:11:21.062Z","dependency_job_id":null,"html_url":"https://github.com/PRGfx/Fusion-Template-Literals","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRGfx%2FFusion-Template-Literals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRGfx%2FFusion-Template-Literals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRGfx%2FFusion-Template-Literals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PRGfx%2FFusion-Template-Literals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PRGfx","download_url":"https://codeload.github.com/PRGfx/Fusion-Template-Literals/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243392315,"owners_count":20283563,"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":["neos-fusion","neoscms"],"created_at":"2024-11-19T05:54:21.199Z","updated_at":"2025-12-29T23:09:14.347Z","avatar_url":"https://github.com/PRGfx.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Prgfx.Fusion.TemplateLiterals\n\nA [Neos Fusion](https://github.com/neos/typoscript) DSL implementation based on tagged template literals in javascript.\n\n```\ncomposer require prgfx/fusion-template-literals\n```\n\n## Usage\nBy default this package defines the DSL identifier `plain`, but you can alias it for more meaningful tags for your application.\n```js\np = Some.Example:Prototype {\n    value = plain`Some text with ${I18n.translate('interpolated')} values`\n}\n```\n\nThis package comes with two implementations: an array-renderer (creating a fusion array-like object (e.g. `Neos.Fusion:Array` or `Neos.Fusion:Join` as per configuration)) and an eel-expression renderer.  \nThe latter has the advantage that you may reference variables as `${this.variable}` as it would seem intuitive:\n```js\ntrackingId = ${Configuration.setting(...)}\nsnippet = inline`(w=\u003e { w.qa=w.qa||[];w.qa.push('create', '${this.trackingId}');})(window);`\n```\n**However** this does not work well with multiline blocks as the eel expression does not properly output newlines. This would be fine for snippets like shown above with block mode `compress` (see below). (After all this package mainly targets such scenarios.)\n\n## Multiline blocks\nGiven a block-mode modifier in the first line (and nothing else in this line), multiline blocks may be interpreted differently.\nThe block-mode modifier can be configured in `Prgfx.Fusion.TemplateLiterals.blockDelimiters` to your preferences.\nThere are different multiline block-modes:\n\n### default\nonly cut off surrounding empty lines, keeps the rest as is\n```js\nvalue = plain`\n    line 1\n    line 2\n`\n// will not contain the first and last \"empty\" line\n```\n\n### block\nwill trim all indentation\n```js\nvalue = plain`|\n    line 1\n        line 2\n    line 3\n`\n// will return 'line 1\\n    line 2\\nline3'\n```\n\n### singleLine\nwill trim all indentation and join newlines with a single space.  \ndouble newlines will create a line break.\n```js\nvalue = plain`\u003e\n    line 1\n    line 2\n\n    line 3\n`\n// 'line 1 line 2\\nline3'\n```\n\n### compress\ncompared to singleLine will remove *all* surrounding whitespace per line:\n```js\nvalue = plain`\u003e\u003e\nif (foo) {\n    console.log(foo);\n}\n`\n// 'if (foo) { console.log(foo); }'\n```\n\n## Custom implementations\nThis package is implemented in a way that you can easily extend the `PlainTemplateLiterals` implementation and override the `generateCode` method.\nThis method receives `stringParts: string[]` and `...expressions: string[]` just like the javascript equivalent.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprgfx%2Ffusion-template-literals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprgfx%2Ffusion-template-literals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprgfx%2Ffusion-template-literals/lists"}