Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress From Bootstrap to WordPress Setup a Bootstrap Theme Add Bootstrap CSS via the functions.php File

Is there a good reason to not call Bootstrap and it's CSS from the CDN links?

Is having bootstrap in the local file system necessary? I have always used CDN links as my go-to for calling bootstrap in sites that aren't Wordpress based.. When you are building lots of sites locally, these local files can really add up to a meaningful amount of space, especially if you're regularly backing up your library.

3 Answers

Jack Spangenberg
Jack Spangenberg
643 Points

If you self-host bootstrap's CSS and JS you can reduce loading times.

+1 You're also protected against downtime or dodgy updates on the CDN. It's unlikely, but it could happen. Also If you're only using a small part of bootstrap you can delete most of it, again improving load time. Before flex and grid, I used to only use bootstrap for its layout classes for example.

IF I had to guess, I would imagine the primary reason would be having total control over what's in the library so you don't wake up at 2 am to users complaining your site's messed up because an update was implemented on the CDN.

Moderator moved response from Comment Section to Answers

Thanks for the answer! I think for the purpose of local development, I'm going to keep relying on the CDN, but both answers here are strong ones.