Trying to make external HTML templates editable in GrapesJS #6732
Unanswered
Pavan-Kumar-KN
asked this question in
Q&A
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone,
I’ve been working with GrapesJS for a while now and I’m trying to build something a bit different. I’m not sure if I’m approaching this the right way, so I thought I’d ask here before I go too deep in the wrong direction.
What I’m trying to do is let users bring HTML templates from anywhere — like Envato, AI-generated code, or even their own files — and load them into GrapesJS so they can edit them visually.
and also the feature flow is the user will upload the files directly to our application !!
In theory it sounded simple. In reality, it’s getting messy.
Right now I’m just loading things using setComponents and setStyle, and it works for basic templates. But as soon as the HTML gets even slightly complex, everything starts breaking in different ways.
One big issue is JavaScript. A lot of templates depend on JS for things like sliders, dropdowns, or interactions. Since GrapesJS doesn’t execute scripts, the UI looks fine but doesn’t behave correctly. I understand why scripts are blocked, but I’m not sure what the right way is to handle this. Should I be using an iframe preview? Or is there a better pattern people follow?
Another problem is structure. Most external HTML is not clean or component-based. So when it gets loaded into the editor, it becomes really hard to edit properly. Everything is just nested divs with no real meaning. I’m wondering if anyone has found a good way to “clean” or transform imported HTML into something more usable inside GrapesJS.
CSS is also becoming a headache. Some templates bring huge global styles that affect everything. Sometimes it even interferes with the editor itself. I’ve tried isolating things but I don’t feel confident about the approach yet.
Assets are another thing — images, fonts, external libraries. Right now I’m not handling this in a solid way, and I feel like this will break at scale.
At this point I feel like I’m trying to force something that might need a different architecture altogether.
If anyone here has tried something similar — importing arbitrary templates and making them editable — I’d really like to know how you approached it. Even if it didn’t work, that would still help.
I’d appreciate any direction, even if it’s just “don’t do it this way”.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions