Issue #5249πŸ’¬ AnsweredOpened Jul 24, 2023by pittleCheung0 reactions

Editor?.Css.addRules(targetCss);

Quick answerby artf

This is not a bug, Css.addRules doesn't have any option argument. You can open a discussion in regard to this topic and we can see if it makes sense to introduce it

Read full answer below ↓

Question

GrapesJS version [X] I confirm to use the latest version of GrapesJS What browser are you using? latest version of Chrome Reproducible demo link null Describe the bug How to reproduce the bug? editor?.Css.addRules(targetCss); What is the expected behavior? editor?.Css.addRules(targetCss); it add style at end <img width="826" alt="image" src="https://github.com/GrapesJS/grapesjs/assets/114127651/28425b0a-b9f7-46a8-b8bc-736aa112cc3c"> What is the current behavior? I help editor?.Css.addRules(targetCss,{at : 0}); I want to add a style to the beginning of an array instead of the end. ... If is ne...

Answers (3)

artfβ€’ Jul 25, 2023

This is not a bug, Css.addRules doesn't have any option argument. You can open a discussion in regard to this topic and we can see if it makes sense to introduce it

pittleCheungβ€’ Jul 26, 2023

ok, I get it,I need to add some styles in front of an array, not at the end. such as arr.unshift(css) How can I do that? I might need a little help from you

GJS Helperβ€’ May 17, 2026

The behavior you're observing with editor.Css.addRules() is actually the expected and intended functionality of the GrapesJS CSS API. By default, when you use editor.Css.addRules(targetCss);, the new CSS rules are appended to the end of the stylesheet managed by GrapesJS. This is a common pattern i...

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.