Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Stanimir Stoyanov

    (@sstoqnov)

    SiteGround Representative

    Hey @marcoragogna,

    We are displaying the styles that are hooked to wp_enqueue_style, but there are other techniques to include style and some plugins don’t use the wp_enqueue_style, that’s why their styles are not displayed in the exclude list.

    You can add the following in your functions.php file and the script you have mentioned will be excluded from the combination:

    
    add_filter( 'sgo_css_combine_exclude', 'css_combine_exclude' );
    function css_combine_exclude( $exclude_list ) {
        // Add the style handle to exclude list.
        $exclude_list[] = 'nf-display';
    
        return $exclude_list;
    }
    

    Regards,
    Stanimir

    Thread Starter Drake

    (@marcoragogna)

    Hi Stanimir, for your answer, but unfortunately it doesn’t work.

    I checked the problem here on our website: https://www.crazywebstudio.co.th/

    And by debugging the Combinator file and the variable

    $styles->to_do

    I don’t even the specific CSS in the list.

    Array
    (
        [0] => dashicons
        [1] => admin-bar
        [2] => wp-block-library
        [3] => dica-lightbox-styles
        [4] => swipe-style
        [5] => wtfdivi-user-css
        [6] => essential-grid-plugin-settings
        [7] => tp-font-awesome
        [8] => siteground-optimizer-combined-styles-header
        [9] => parent-style
        [10] => divi-style
        [11] => quadmenu-divi
        [12] => quadmenu-normalize
        [13] => quadmenu-widgets
        [14] => quadmenu
        [15] => quadmenu-locations
        [16] => fontawesome5
        [17] => divi-carousel-styles
        [18] => et-builder-googlefonts-cached
        [19] => et-shortcodes-responsive-css
        [20] => magnific-popup
    )

    but in any case when the option Combine CSS is active, that file disappear from the output.

    That’s really strange.

    Ninja Forms plugin load the CSS in this way:

    public static function enqueue_styles_display( $css_dir ) {
            switch( Ninja_Forms()->get_setting( 'opinionated_styles' ) ) {
                case 'light':
                    wp_enqueue_style( 'nf-display',      $css_dir . 'display-opinions-light.css', array( 'dashicons' ) );
                    wp_enqueue_style( 'nf-font-awesome', $css_dir . 'font-awesome.min.css'       );
                    break;
                case 'dark':
                    wp_enqueue_style( 'nf-display',      $css_dir . 'display-opinions-dark.css', array( 'dashicons' )  );
                    wp_enqueue_style( 'nf-font-awesome', $css_dir . 'font-awesome.min.css'      );
                    break;
                default:
                    wp_enqueue_style( 'nf-display',      $css_dir . 'display-structure.css', array( 'dashicons' ) );
            }
        }

    Any other idea?

    Thread Starter Drake

    (@marcoragogna)

    Ok I found a workaround. The root cause is that Ninja Forms enqueue the CSS style only at the time that the form is rendered.

    ‘nf-display’ has a dependency on ‘dash-icon’ and due to the fact that at that point the ‘dash-icon’ is already combine, WordPress doesn’t enqueue ‘nf-display’ cause it is not able to resolve the dependency.

    I don’t know if you can do something about that, but I temporary remove excluded ‘dash-icons’ from minification and it now works correctly.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Some CSS are not recognized’ is closed to new replies.