Issue #2820πŸ’¬ AnsweredOpened June 10, 2020by Rubark0 reactions

Dynamically attach CDN(external resources) to canvas head #grapesjs #attach #cdn #external #resources

Quick answerby artf

You if need to save dynamic css/js inside the template you have to append them to the body (eg. editor.addComponents('<script src="...">..')) if you need them outside the template (which manages ONLY the body), like in the <head>, you can append even manually to the canvas but it's up to you storing/loading them to th...

Read full answer below ↓

Question

Dear artf I'm trying to add feature to my application, for end user. It's a tool for - Dynamically adding CSS and JS CDN-s. Like in jsFiddle or Codepen, when we add external resources(css/js) CDN-s. That means, that after adding a link for js, or css, it will appear in Canvas iFrames head. Unfortunately I couldn't find any way to do that.I can't use canvas: { scripts: ['......'], }, because the end user will be able to add CDN in process of making his tamplateI can't append to canvas head, because it's simply won't save it. So, what to do? Any solutions? Any packages? @artf

Answers (1)

artfβ€’ June 17, 2020

You if need to save dynamic css/js inside the template you have to append them to the body (eg. editor.addComponents('<script src="...">..')) if you need them outside the template (which manages ONLY the body), like in the <head>, you can append even manually to the canvas but it's up to you storin...

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Related tutorials

In-depth guides on the same topic.

All tutorials β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.