Issue #3116💬 AnsweredOpened November 6, 2020by aadilmehrajbhat1 reactions

How to load css that can viewed in code viewer and also exported while saving

Quick answerby artf1

@AadilMehrajBhat First of all, display: 'block' is not a valid CSS value for that property (it should be display: block) and then .d-block is not used anywhere in your template so the result is automatically optimized by removing unused styles

Read full answer below ↓

Question

Hi :wave: I am trying to load some CSS within the editor as part of the theme, I am able to link stylesheets as part of loading but the problem that I am facing is when loading the styles directly using <style> tag, I am able to view the serialized version via editor.getStyle() but editor.getCss() only contains the protectedCss. I am confused about how the CSS styles are added within the template style css property when exporting or viewing within code viewer, also how to manipulate the CSS rules that are not component specific but generally. I tried to dig more in the docs especially inCssCo...

Answers (2)

artfNovember 9, 2020

@AadilMehrajBhat First of all, display: 'block' is not a valid CSS value for that property (it should be display: block) and then .d-block is not used anywhere in your template so the result is automatically optimized by removing unused styles

GJSBlockMay 17, 2026

Thanks for reporting this, @aadilmehrajbhat. Great question about [HELP WANTED] How to load css that can viewed in code viewer and also exported while saving. The recommended approach with StyleManager is to use the event-driven API. Start here: Check the GrapesJS documentation for your specific mo...

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.