Closed gxanshu closed 1 year ago
This is intentional and I'm not planning to change this behaviour as you can easily create specific CSS selectors if you need different styles per page. The big benefit of this approach is to allow reusing selectors across pages.
I think I'm experiencing an issue with this approach. I'm saving the pages to server like this:
const component = page.getMainComponent();
const css = editor.getCss({ component, avoidProtected: true })
saveToBackendApi(component,css)
and loading them like this in a loop:
const page = pageManager.add({
name: pageName,
component: pageHtml || `<div> ${pageName} </div>`,
styles:css,
});
The css rules targeting ids are working fine, but the rules with a class are duplicating even when loaded in separate pages.
For instance the # of css rules for .gjs-row
class keeps increasing after after each save + load.
GrapesJS version
What browser are you using?
Chrome latest
Reproducible demo link
https://codesandbox.io/s/withered-bush-wv29dx?file=/index.js
Describe the bug
How to reproduce the bug?
What is the expected behavior? every page contains there own style not include the CSS of other pages ...
What is the current behavior? currently the CSS of all pages will merged and apply on all pages. for more details visit the reproduction link and check the code of all pages ...
If is necessary to execute some code in order to reproduce the bug, paste it here below:
Code of Conduct