Issue #3053✓ SolvedOpened September 30, 2020by anushabivera5 reactions

Allowing user to add a global stylesheet to canvas dynamically

Quick answerby RJCAM4

Hi @anushabivera if you want to load the stylesheets on init (local and with cdn) you can simply add the css/js links to the canvas property on editor init function, like this: If you want to add them dynamically you can try this (example with materialize): BTW: This question has already been asked, any doubts you can...

Read full answer below ↓

Question

Hi, I wanted to provide the user the option to load a custom stylesheet to the canvas. This is so that the user can apply the custom defined styles to the control as class instead of inline style and also to maintain uniformity among the various users using the grapesjs based editor tool to generate the html template. Does Grapesjs already support loading stylesheet dynamically? Any guidance with this issue will be of great help to me.

Thank you, Anusha

Answers (3)

👍 Most helpfulRJCAMSeptember 30, 2020

Hi @anushabivera if you want to load the stylesheets on init (local and with cdn) you can simply add the css/js links to the canvas property on editor init function, like this: If you want to add them dynamically you can try this (example with materialize): BTW: This question has already been asked...

theSC0RPNovember 10, 2020

I got it! I removed it by using an id on the link tag.

anushabiveraOctober 2, 2020

Thank you @RJCAM . My plan is to provide the functionality as an attribute of the canvas and the user can enter the url of the custom stylesheet as value of the attribute

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 →

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.