Issue #564Opened November 23, 2017by paulroberttaylor-zz0 reactions

Use external css/fonts for plugin

Question

Hi,

I have an idea for an app that I think the people in my field would find useful. Essentially, there is a framework that we use for application development but there is no UI builder for it.

It has a fairly large css/icons/svg/fonts asset folder.

What I'd like to do is be able to create a plugin that will include these assets, instead of having to add each component's styles into the markup of the blocks.

How can this be achieved?

Thanks, Paul

Answers (3)

artfNovember 23, 20170 reactions

Hi Paul, you can inject external styles in this way

const editor = grapesjs.init({
  ...
  canvas: {
    styles: ['...file1.css', '...file2.css', '...']
  }
});

paulroberttaylor-zzNovember 24, 20170 reactions

Fantastic! Thanks @artf

suraj740November 29, 20170 reactions
Code SnippetTEXT
Hi @paulroberttaylor  , how you have included fonts inside styles,
i am also doing same but nothing change happens
const editor = grapesjs.init({
  ...
  canvas: {
    styles: ['<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">']
  }
});

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.