Issue #2635๐Ÿ’ฌ AnsweredOpened Mar 10, 2020by micker2 reactions

Load external css in editor

Quick answerby pouyamiralayiโค 1

@micker you must include them like this: I do not see the `canvas` object in your setup. Cheers!

Read full answer below โ†“

Question

hello i search a lot but i didn't find how to load a css file inside editor My code regards of other issue i add styles: [\'http://localhost/flexidev/templates/shaperhelix3/css/template.css\'] no real error but no style ... what i forgot ? function fclayoutinitbuilder(editorsfx, elementid) { /*Lets say, for instance, you start with your already defined HTML templateand you\'d like to import it on fly for the user / var LandingPage = { html: \'<h2>This is the layout area, you may drag and drop to add your blocks here, to load flexicontent field use data panel to insert flexicontent block</h2>\...

Answers (3)

pouyamiralayiโ€ข Mar 10, 2020

@micker you must include them like this:

    canvas: {
        styles: ['bundle1.css', 'bundle2.css'],
        scripts: ['bundle1.js', 'bundle2.js'],
    },

I do not see the canvas object in your setup. Cheers!

pouyamiralayiโ€ข Mar 12, 2020

@micker if your customCss is a url, that's the way to include it. but if you you have some styles that you want to include by hand, here is the procedure:

editor.addComponents(
  `
     <style> div { background: teal} </style>
  `
)

Cheers!

mickerโ€ข Mar 10, 2020

i try to use https://grapesjs.com/docs/modules/Storage.html#store-and-load-templates but i not sure about this ... if i add canvas like this i have this error seams doesn't link `canvas: { scripts: null, styles: [\'http://localhost/flexidev/templates/shaper_helix3/css/template.css\'] //Is there any...

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.