GrapesJS / grapesjs

Free and Open source Web Builder Framework. Next generation tool for building templates without coding
https://grapesjs.com
BSD 3-Clause "New" or "Revised" License
22.36k stars 4.05k forks source link

Removing class from css when chained #152

Closed Dari4sho closed 1 year ago

Dari4sho commented 7 years ago

Hey guys, following example of my problem: I select an element on the canvas - next to the existing class, I add a custom class in the style manager (both selected so it's chained: .class.class) - edit some styles - remove the custom class = the chained css-code stays for export (.class.class)

Editing classes independently (.class) and deleting them also deletes the class in the css-code. Is this intentioned behaviour? If not, can we do something about it?

I love this project! Thanks for all the work.

artf commented 7 years ago

Thanks @Dari4sho I'd say the exporter is not optimizing properly

Palash-Mandal commented 2 years ago

Hello @artf , Is there any update on core clear canvas command. the unused CSS are not removed. I am using latest version of grape min /! grapesjs - 0.19.4 / Please let me know any hook or something methods so that I can clear forcefully

artf commented 1 year ago

Closing this as it's quite old and inactive.

Anyway removing not used CSS rules it's not always a safe option (eg. one class might be toggled dynamically via JS in the final template) but in case you're aware of that you can get the CSS with only matched rules

editor.getCss({ onlyMatched: true })