Issue #2820Opened June 10, 2020by Rubark0 reactions

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

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.

  1. I can't use canvas: { scripts: ['......'], }, because the end user will be able to add CDN in process of making his tamplate
  2. I 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)

artfJune 17, 20200 reactions

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 the user

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...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.