Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.