Support

Account

Home Forums Gutenberg Best practice to avoid backend css collisions Reply To: Best practice to avoid backend css collisions

  • Thank you for your reply. Though not much help to my situation I would caution you on not using add_editor_style(). if you enqueue your css with a different method, your styles will not be applied to previews like blocks and patterns (maybe even style previews though I haven’t confirmed this).

    Ideally we should be able to exclude an element from a page. Like “apply these styles to this page but ignore all divs with the class of .acf-block-component” something like:

    
    :not(.acf-block-component) {
    @import "links"
    ... ect ...
    }
    
    // in the editor this would output something like:
    
    .editor-styles-wrapper :not(.acf-block-component) a { color: blue }
    

    naturally this will not work. and since there does not seem to be an easy way around this. I’d propose ACF be much more specific with their block editor styles even at the risk or breaking the WordPress branding. I’d rather see a ACF themed block editor than a busted one that I have to manually fix every build. just my 2 cents, would still love to hear if anyone has an elegant solution to this issue.