When I run “themes check” , it recommends not to use CDN.
I am using Bootstrap CDN this way

function underscore_bootstrap_wp_scripts() {

/*   bootstrap and font awesome and animate css  */
wp_enqueue_style( 'bootstrap_cdn', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' );
wp_enqueue_style( 'fontawesome_cdn', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );

/*   default underscores styles  */
wp_enqueue_style( 'underscore_bootstrap_wp-style', get_stylesheet_uri() );

/*  bootstrap js  */
wp_enqueue_script('bootstrap_js_cdn', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js',array('jquery'),'',true);

/*   default underscores js  */
//wp_enqueue_script( 'underscore_bootstrap_wp-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'underscore_bootstrap_wp-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );

/* my stylesheet and js */
wp_enqueue_style( 'custom_style_css', get_template_directory_uri(). '/css/main.css' );
wp_enqueue_script('custom_js', get_template_directory_uri(). '/js/main.js',array('jquery','bootstrap_js_cdn'),'',true);

if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    wp_enqueue_script( 'comment-reply' );
  }
}

The ” Themes Check ” Plugin shows –

RECOMMENDED: Found the URL of a CDN in the code: maxcdn.bootstrapcdn.com/font-awesome. You should not load CSS or Javascript resources from a CDN, please bundle them with the theme.

RECOMMENDED: Found the URL of a CDN in the code: maxcdn.bootstrapcdn.com/bootstrap. You should not load CSS or Javascript resources from a CDN, please bundle them with the theme.

2 Answers
2

Your theme should not depends on any external link library. There is no guarantee when that library can be taken down. That’s the reason all of your theme assets should be package with theme, to prevent the future risk.

Leave a Reply

Your email address will not be published. Required fields are marked *