Hi,
How i can integrate handlebars or other template engine with GrapeJS?
I mean to create eg. dynamic component with product details:
const blockManager = editor.BlockManager;
blockManager.add("product", {
label: "Product",
type: "text",
attributes: { class: "fa fa-columns" },
content: `
<div>
<h2>{{product.name}}</h2>
<div>{{product.details}}</div>
</div>
`
});
And show parsed data in GrapeJS editor eg.
<div>
<h2>Sample product</h2>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque tristique molestie mi, a commodo quam cursus eget.</div>
</div>
But on export user must get raw data, i mean code with handlebars content.
Someone can help?
You should create a custom Component which implements the template engine inside its view (eg. compile the template inside the render method)
Hi andre2, do you complete this solution for handlebars integration? can you share some code please?
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi andre2, do you complete this solution for handlebars integration? can you share some code please?