Issue #444Opened October 23, 2017by ronaldaug6 reactions

How to load css link into the head tag?

Question

Hello, First of all, thanks for contributing such an amazing js framework. I am very new to grapesjs. And github too.

canvas: {
    scripts: ['https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js']
  }

https://github.com/artf/grapesjs/wiki/Components-&-JS#template-related According to grapesjs wiki, I load js links inside the canvas as the above codes and it works fine.

But when I try with css links like this, it doesn't work.

canvas: {
      links : ['https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'] 
  }

Some people here suggest to add those CSS links directly under the id="gjs". I did it but what happen is if I clean the canvas, it also clean my css links and CSS doesn't work anymore. My question is how can I load CSS link into the head tag?

Answers (3)

artfOctober 23, 20174 reactions

You were almost there :)

canvas: {
    styles: ['https://...'] 
}
ronaldaugOctober 23, 20171 reactions

Thank you so much @artf , it works like a charm.

coder-strangeNovember 19, 20181 reactions

You have to include separately while rendering, it won't come in getHtml() or anything.

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.