{"id":14973751,"url":"https://github.com/valantic/vue-pimcore-generator","last_synced_at":"2025-10-27T02:31:23.949Z","repository":{"id":55042508,"uuid":"305368308","full_name":"valantic/vue-pimcore-generator","owner":"valantic","description":"Generate Pimcore Twig templates based on your Vue components.","archived":false,"fork":false,"pushed_at":"2021-01-13T13:18:46.000Z","size":113,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-09-28T18:01:26.395Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/valantic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","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":"2020-10-19T11:57:14.000Z","updated_at":"2024-02-11T16:52:10.000Z","dependencies_parsed_at":"2022-08-14T09:51:02.192Z","dependency_job_id":null,"html_url":"https://github.com/valantic/vue-pimcore-generator","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valantic%2Fvue-pimcore-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valantic%2Fvue-pimcore-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valantic%2Fvue-pimcore-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/valantic%2Fvue-pimcore-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/valantic","download_url":"https://codeload.github.com/valantic/vue-pimcore-generator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219861968,"owners_count":16555980,"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":[],"created_at":"2024-09-24T13:49:21.258Z","updated_at":"2025-10-27T02:31:23.580Z","avatar_url":"https://github.com/valantic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vue-Pimcore Generator\n\n[![npm version](https://badge.fury.io/js/%40valantic%2Fvue-pimcore-generator.svg)](https://badge.fury.io/js/%40valantic%2Fvue-pimcore-generator)\n\n`node node_modules/.bin/vue-pimcore-generator --help`\n\n## Elevator Pitch\n\nPimcore uses a WYSIWYG editor to edit documents which is incompatible with Vue components. To alleviate that, this generator opens a web page in the frontend, parses its contents, and creates Pimcore Areabricks. This is done using data attributes in Vue. Creating these Areabricks allows an editor to drag\u0026drop components on a page and being able to see a preview within Pimcore which closely resembles the Vue frontend.\n\n## generator-definitions\n\nThis file defines which pages should be parsed by the Pimcore generator. To see the available options and their use, please see the `generator-definitions.sample.js` file.\n\n## Supported `data-pimcore-*` attributes\n\n- `data-pimcore-areabrick` The name that should be used for the area brick in Pimcore. Only [a-z] are allowed.\n- `data-pimcore-arg` Optional arguments for the Twig tag, e.g. see https://pimcore.com/docs/6.x/Development_Documentation/Documents/Editables/Relation_(Many-To-One).html#page_Using-Restriction\n- `data-pimcore-identifier` The field name of the Twig tag (e.g. `thisisthename -\u003e pimcore_input('thisisthename')`) and entry in the data object. Only [a-z_] are allowed\n- `data-pimcore-disable-editmode` Recursively adds the `disabled` attribute `\u003ca\u003e` tags when in Pimcore's edit mode. Was added to prevent navigation usage in Pimcore's edit mode.\n- `data-pimcore-type` Type of the CMS editor input type and Twig tag (e.g. `input -\u003e pimcore_input('name')`), see [list of editables](https://pimcore.com/docs/6.x/Development_Documentation/Documents/Editables/index.html#page_List-of-Editables)\n- `data-pimcore-document` defines the path to the twig file after the build (e.g. `snippets/my_snippet`) AND source url of the data for GraphQL.\n- `data-pimcore-snippet=\"\u003cname\u003e\"` Defines the root element of a snippet template.\n\n## Examples\n\n### Snippet (complete example)\n\n#### `c-header.vue`\n\nThis is the only file you write by hand.\n\n```vue\n\u003c!-- A layout --\u003e\n\u003cb-jumbotron\n    :class=\"b()\"\n    :header-level=\"5\"\n    lead-tag=\"div\"\n    data-pimcore-type=\"snippet\"\n    data-pimcore-identifier=\"header\"\n    data-pimcore-snippet=\"header\"\n    :data-pimcore-document=\"path\"\u003e\n    \u003ctemplate v-slot:header\u003e\n        \u003cdiv v-if=\"pimcoreDocumentReady\"\n             v-html=\"elements.headline.text\"\n             :class=\"b('header')\"\n             data-pimcore-identifier=\"headline\"\n             data-pimcore-type=\"input\"\u003e\u003c/div\u003e\n    \u003c/template\u003e\n    \u003ctemplate v-slot:lead\u003e\n        \u003cdiv v-if=\"pimcoreDocumentReady\"\n             v-html=\"elements.content.text\"\n             :class=\"b('lead')\"\n             data-pimcore-identifier=\"content\"\n             data-pimcore-type=\"wysiwyg\"\u003e\u003c/div\u003e\n    \u003c/template\u003e\n  \u003c/b-jumbotron\u003e\n```\n\n#### Rendered HTML\n\nGenerated by the browser.\n\n```html\n\u003cdiv \n    data-pimcore-type=\"snippet\" \n    data-pimcore-identifier=\"header\" \n    data-pimcore-snippet=\"header\" \n    data-pimcore-document=\"/snippets/header_shared\" \n    class=\"jumbotron c-header\"\u003e\n    \u003ch1 class=\"display-5\"\u003e\n        \u003cdiv\n            data-pimcore-identifier=\"headline\"\n            data-pimcore-type=\"input\" \n            class=\"c-header__header\"\u003e\n            Pimcore-CaaS-Vue-SPA-PWA-PoC!\n        \u003c/div\u003e\n    \u003c/h1\u003e\n    \u003cdiv class=\"lead\"\u003e\n        \u003cdiv \n            data-pimcore-identifier=\"content\" \n            data-pimcore-type=\"wysiwyg\" \n            class=\"c-header__lead\"\u003e\n            \u003cp\u003e\n                Viel Spass!\n            \u003c/p\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n```\n\n#### Main Twig template\n\n```twig\n\u003cdiv\n    data-pimcore-document=\"/snippets/header_shared\"\n    class=\"jumbotron c-header\"\u003e\n    {{ pimcore_snippet('header') }}\n\u003c/div\u003e\n```\n\n#### Snippet Twig template at `snippets/header_shared.html.twig`\n\n(Actually, three files are generated to have different view for editmode and viewmode.)\n\n```twig\n\u003ch1 class=\"display-5\"\u003e\n    \u003cdiv class=\"c-header__header\"\u003e{{ pimcore_input('headline') }} \u003c/div\u003e\n\u003c/h1\u003e\n\u003cdiv class=\"lead\"\u003e\n    \u003cdiv class=\"c-header__lead\"\u003e{{ pimcore_wysiwyg('content') }} \u003c/div\u003e\n\u003c/div\u003e\n```\n\n### Pimcore Twig Tags\n\nThis Vue code:\n\n```vue\n\u003cdiv data-pimcore-identifier=\"headline\" data-pimcore-type=\"input\"\u003e\u003c/div\u003e\n```\n\nbecomes this Twig code\n\n```twig\n\u003cdiv\u003e{{ pimcore_input('headline') }}\u003c/div\u003e\n```\n\nPlease see [the Pimcore docs](https://pimcore.com/docs/6.x/Development_Documentation/Documents/Editables/index.html) for which `data-pimcore-type`s are supported. The identifier can be any string and generally, snake_case or camelCase are used. kebab-case might lead to troubles dealing with GraphQL responses. And spaces are evil, weallknowthat. \n\nAdditionally, a (second) argument can be passed to the Twig tag using `data-pimcore-arg` such as this example where a relation is restricted to `Product` objects:\n\n```vue\n\u003cdiv data-pimcore-type=\"relations\"\n     data-pimcore-identifier=\"products\"\n     data-pimcore-arg='{\n         \"types\": [\"object\"],\n         \"subtypes\": {\n             \"object\": [\"object\"],\n         },\n         \"classes\": [\"Product\"]\n     }'\n     :class=\"b('productgrid')\"\u003e\n\u003c/div\u003e\n```\n\nProduce this Twig template:\n\n```twig\n\u003cdiv class=\"c-areablock__productgrid\"\u003e\n    {{ pimcore_relations('products', {\n            \"types\": [\"object\"],\n            \"subtypes\": {\n                \"object\": [\"object\"],\n            },\n            \"classes\": [\"Product\"]\n        })\n    }}\n\u003c/div\u003e\n```\n\n### Pimcore Areablocks and Bricks\n\n#### Render mode\n\nThe only difference to normal Twig tags is: `data-pimcore-areabrick` on the parent.\n\n```vue\n\u003cdiv v-for=\"block in elements\"\n    :key=\"block._tagName\"\n    :data-pimcore-areabrick=\"block._type\"\u003e\n\n    \u003cdiv v-if=\"block._type === 'headline'\"\u003e\n        \u003ce-heading tag-name=\"h2\"\n            :data-pimcore-type=\"block.content._tagType\"\n            data-pimcore-identifier=\"content\"\u003e\n            {{ block.content.text }}\n        \u003c/e-heading\u003e\n    \u003c/div\u003e\n    \n    \u003c!-- Add more bricks --\u003e\n\n\u003c/div\u003e\n```\n\n#### Adding-a-new-brick mode\n\nSimply add the brick unconditionally and execute the generator.\n\n```vue\n\u003cdiv v-for=\"block in elements\"\n    :key=\"block._tagName\"\n    :data-pimcore-areabrick=\"block._type\"\u003e\n\n    \u003cc-new-component\n        data-pimcore-type=\"brickname\"\n        data-pimcore-identifier=\"content\"\u003e\n        Lorem ipsum\n    \u003c/c-new-component\u003e\n    \n    \u003c!-- Rest of the loop --\u003e\n\n\u003c/div\u003e\n```\n\nNote: the name of the Vue component is irrelevant. (The parsing happens in a browser at which stage the Vue component names are no longer visible.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalantic%2Fvue-pimcore-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvalantic%2Fvue-pimcore-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvalantic%2Fvue-pimcore-generator/lists"}