4-Bootstrap and jQuery

Key Objectives

  • Set up Bootstrap & jQuery as npm packages.

  • Set up proper links in head.

  • Set up script tags.

  • Understand the rule of 12s in Bootstrap.

Video

Overview

In this module, we set up Bootstrap to allow our application to be responsive, meaning that it will appear nice on a number of different device sizes (as big as iMac and as small as iPhone 5). Bootstrap is an indispensable tool for modern web developers, and this section covers just the tip of the iceberg.

Notes/Tips

The Bootstrap docs are phenomenal. Go take a look here. At this point, you don't have to understand jQuery, you just have to know that Bootstrap uses it. We'll talk about jQuery more later. Although the newest version (4.0) of Bootstrap was recently released, we are still using 3.3.7. It's perfectly safe, but be aware that version 4.0 is out there. You might run into projects that use it.

Steps

  1. Please start by taking a look at this instructional video.

  2. Jump onto the module-3-bootstrap-and-jquery branch and run npm install.

  3. Then, run gulp serve.

  4. Play around with the Bootstrap columns in our app and get a feel for the rule of 12s as discussed in the video. When you are done, run git reset --hard so that you can switch branches later. This will get rid of the changes that you just did.

  5. In your own project, here are some things you'll want to do to get Bootstrap working:

    • Run npm install jquery bootstrap font-awesome --save

    • Put the proper link tag for Bootstrap.css in the head of your index.html file.

    • Put the proper script tags for jQuery and Bootstrap at the bottom of the body.

    • Bootstrap needs jQuery. jQuery needs to be listed first because it needs to load first.

    • Add a Bootstrap navbar of your own choosing. It does not have to be the one that you end up using, just a navbar to get working. You will customize it later. The docs have excellent navbars. There's also bootsnipp.com.

    • If you get a customized navbar, you might have extra CSS to add. Add any extra CSS to your main.css file.

    • Commit your code and push it to your GitHub repository when finished.

    • After you have Bootstrap working, go to the next module.

Last updated