Title: CSS Combinator Dashicons
Last modified: September 4, 2019

---

# CSS Combinator Dashicons

 *  [shanept](https://wordpress.org/support/users/shanept/)
 * (@shanept)
 * [6 years, 9 months ago](https://wordpress.org/support/topic/css-combinator-dashicons/)
 * I’ve been having issues with certain fonts not wanting to enqueue, such as WP’s
   dashicons.
 * I’ve managed to narrow it down to a single test in the combinator logic to see
   if a file should be combined.
 * See inside the loop in Combinator::combine_styles. The following line:
    `@strpos(
   Helper::get_home_url(), parse_url( $wp_styles->registered[ $handle ]->src, PHP_URL_HOST))
   === false || // Skip all external sources.`
 * Upon further investigation, I have noticed that all files that I expect to be
   included all specify ONLY a file path in the source, instead of a full URL.
 *     ```
       dashicons: skip "https://staging4.aeontech.com.au/" !== "" ("/wp-includes/css/dashicons.min.css")
       admin-bar: skip "https://staging4.aeontech.com.au/" !== "" ("/wp-includes/css/admin-bar.min.css")
       wp-block-library: skip "https://staging4.aeontech.com.au/" !== "" ("/wp-includes/css/dist/block-library/style.min.css")
       ```
   
 * The above output was generated as follows:
    `printf( "reason \"%s\" !== \"%s\"(\"%
   s\")\n", Helper::get_home_url(), parse_url( $wp_styles->registered[ $handle ]-
   >src, PHP_URL_HOST ), $wp_styles->registered[ $handle ]->src );`
 * In order to resolve this, I added a check at the start of the foreach loop to
   prepend the site URL to any sources that include a path only. This has resulted
   in the new `$src` variable, which I have gone to the liberty of putting through
   the function.
 *     ```
       // Get groups of handles.
       foreach ( $styles->to_do as $handle ) {
       	$src = $wp_styles->registered[ $handle ]->src;
   
       	// Ensure the src has a host. If not, it is relative to the WordPress domain.
       	if ( $src{0} === '/' ) {
       		$src = Helper::get_home_url() . $src;
       	}
   
       	// Get the src host.
       	$host = parse_url( $src, PHP_URL_HOST );
   
       	if (
       		( true === $in_header && $styles->groups[ $handle ] > 0 ) || // Bail if the style is not in the header/footer.
       		in_array( $handle, $excluded_styles ) || // If the style is excluded from combination.
       		false === $src || // If the source is empty.
       		@strpos( Helper::get_home_url(), $host ) === false  || // Skip all external sources.
       		pathinfo( $src, PATHINFO_EXTENSION ) === 'php' || // If it's dynamically generated css.
       		is_int( strpos( $handle, 'elementor-post-' ) ) // Exclude all elementor styles.
       	) {
       		continue;
       	}
   
       	// Check for inline styles.
       	$item_inline_style = $styles->get_data( $handle, 'after' );
   
       	if ( ! empty( $item_inline_style ) ) {
       		// Check for inline styles.
       		$inline_styles .= implode( $item_inline_style, "\n" );
       	}
   
       	$content[ $src ] = $this->get_style_content( $src );
   
       	// Remove the style from registered styles.
       	unset( $wp_styles->registered[ $handle ] );
       }
       ```
   
 * Kind Regards
    Shane Thompson
    -  This topic was modified 6 years, 9 months ago by [shanept](https://wordpress.org/support/users/shanept/).
    -  This topic was modified 6 years, 9 months ago by [shanept](https://wordpress.org/support/users/shanept/).
    -  This topic was modified 6 years, 9 months ago by [shanept](https://wordpress.org/support/users/shanept/).

The topic ‘CSS Combinator Dashicons’ is closed to new replies.

 * ![](https://ps.w.org/sg-cachepress/assets/icon-256x256.gif?rev=2971889)
 * [Speed Optimizer - The All-In-One Performance-Boosting Plugin](https://wordpress.org/plugins/sg-cachepress/)
 * [Support Threads](https://wordpress.org/support/plugin/sg-cachepress/)
 * [Active Topics](https://wordpress.org/support/plugin/sg-cachepress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sg-cachepress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sg-cachepress/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [shanept](https://wordpress.org/support/users/shanept/)
 * Last activity: [6 years, 9 months ago](https://wordpress.org/support/topic/css-combinator-dashicons/)
 * Status: not a support question