How To Disable The Drupal Bootstrap CDN Sub-Theme

Author:
phil
Created:
Thursday, January 18th, 2018
Last Updated:
Monday, April 16th, 2018

Disclaimer: Accessing the information on this page means you agree to the Sites Terms of Service


At some point, you decided to use the Bootstrap CDN starterkit theme provided by the Bootstrap Drupal Theme. You probably ran across a google pagespeed of your site, and they told you to get rid of those external loading files like bootstrap.min.css and bootstrap.min.js.

Going back to your site, you changed the CDN delivery method to "None" and reloaded your site, only to watch in the horror of expectations that the theme just blew up... So you go back and quickly turn on the CDN, refreshed and sighed a big relief.

Then you decided to see if someone else had done the same thing and maybe figured it out.

That's pretty much what happened to me, and yup, I found where someone figured it out. I'm going to re-post their steps with a few minor tweaks and better explanation, but all the kudos go to KimNyholm, the guy figured it out. If you're using a bootswatch theme, I can't help too much (yet) but you might check out that link for some tips.

Disclaimer:

This is designed to work with the "Bootstrap" theme (not tested against the bootswatch themes like "Journal")

In theory, you can grab the bootstrap.min.css from the legacy bootswatch cdn and simply overwrite the one in the following steps.

https://www.bootstrapcdn.com/legacy/bootswatch/

https://github.com/twbs/bootstrap/releases

Step 1

On Github, download and extract the compiled distribution and place all of the files in YOURTHEME/bootstrap

Note: What you're looking for is bootstrap-3.x.x-dist.zip

All said and done, you should have a folder structure that looks like this:

YOURTHEME/bootstrap
YOURTHEME/bootstrap/css
YOURTHEME/bootstrap/js
YOURTHEME/bootstrap/fonts

Step 2

Edit the .info file for YOURTHEME/SUBTHEME.info add the following lines:

  • stylesheets[all][] = bootstrap/css/bootstrap.min.css
  • scripts[] = bootstrap/js/bootstrap.min.js

Step 3

Disable the Bootstrap CDN in admin/appearance/settings/YOURTHEME/advanced

(Change the CDN Provider to "None")

Step 4

Cross your fingers and then clear all of the site caches.

Conclusion

That's it! Hopefully everything worked out and you're good to go.

Post Comment

Comments

Perfect and simple explanation!

Much thanks!