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

Use external css/fonts for plugin

快速解答by artf

Hi Paul, you can inject external styles in this way

Read full answer below ↓

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, 2017

Hi Paul, you can inject external styles in this way

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

paulroberttaylor-zzNovember 24, 2017

Fantastic! Thanks @artf

suraj740November 29, 2017
代码片段TEXT
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...

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.