HTML Diff
0 added 0 removed
Original 2026-01-01
Modified 2026-02-21
1 <p>Theater begins with a clothing wrap, and using Bootstrap starts with being connected to a page. We can do it in several ways, from connecting ready-made CSS and JS files to using the SASS preprocessor to add the necessary components.</p>
1 <p>Theater begins with a clothing wrap, and using Bootstrap starts with being connected to a page. We can do it in several ways, from connecting ready-made CSS and JS files to using the SASS preprocessor to add the necessary components.</p>
2 <h2>Connecting via CDN</h2>
2 <h2>Connecting via CDN</h2>
3 <p>Before you learn how to connect via CDN, it’s essential to understand what CDN is.</p>
3 <p>Before you learn how to connect via CDN, it’s essential to understand what CDN is.</p>
4 <p>CDN is short for Content Delivery Network. Most often, the CDN system is a few servers in different countries. They store files that we can plug into the project. Depending on the user’s location, we receive the file from the server that provides the minimum delay.</p>
4 <p>CDN is short for Content Delivery Network. Most often, the CDN system is a few servers in different countries. They store files that we can plug into the project. Depending on the user’s location, we receive the file from the server that provides the minimum delay.</p>
5 <p>To connect Bootstrap using CDN, you should add the necessary files in HTML. You can find fresh links on the Bootstrap documentation page. At present, it looks as follows:</p>
5 <p>To connect Bootstrap using CDN, you should add the necessary files in HTML. You can find fresh links on the Bootstrap documentation page. At present, it looks as follows:</p>
6 <p>This course describes which components require JavaScript. If you don’t use these components, you may not need to link scripts to the page, which improves the page’s loading speed. This criterion is essential in development. Search engine ranking algorithms also use it.</p>
6 <p>This course describes which components require JavaScript. If you don’t use these components, you may not need to link scripts to the page, which improves the page’s loading speed. This criterion is essential in development. Search engine ranking algorithms also use it.</p>
7 <h2>Connecting CSS Locally</h2>
7 <h2>Connecting CSS Locally</h2>
8 <p>Developers don’t always want to trust external servers they can’t control. No one can guarantee that the CDN won’t fail when it’s most needed, like when billionaire investors check it out. To avoid this situation, you can place all the Bootstrap files in your working directory and connect them locally.</p>
8 <p>Developers don’t always want to trust external servers they can’t control. No one can guarantee that the CDN won’t fail when it’s most needed, like when billionaire investors check it out. To avoid this situation, you can place all the Bootstrap files in your working directory and connect them locally.</p>
9 <p>You can download all the necessary files from the official<a>Bootstrap</a>page or via<a>the GitHub repository</a>. If you use it, then it’s the<em>dist</em>directory you want to look at.</p>
9 <p>You can download all the necessary files from the official<a>Bootstrap</a>page or via<a>the GitHub repository</a>. If you use it, then it’s the<em>dist</em>directory you want to look at.</p>
10 <p>Inside the<em>dist</em>directory, we can find the following structure of CSS files:</p>
10 <p>Inside the<em>dist</em>directory, we can find the following structure of CSS files:</p>
11 <p>There are more files than when you connect Bootstrap via CDN in the CSS directory. With this approach, it’s possible to include only the necessary parts of CSS:</p>
11 <p>There are more files than when you connect Bootstrap via CDN in the CSS directory. With this approach, it’s possible to include only the necessary parts of CSS:</p>
12 <ul><li>bootstrap-grid.css. The file contains all the styles responsible for creating grids. This file is enough when you need only the Bootstrap grid in your project. In this case, we can skip all the other dependencies, including JavaScript</li>
12 <ul><li>bootstrap-grid.css. The file contains all the styles responsible for creating grids. This file is enough when you need only the Bootstrap grid in your project. In this case, we can skip all the other dependencies, including JavaScript</li>
13 <li>bootstrap-reboot.css. Contrary to its name, this file doesn’t reset the standard browser styles like reset.css but sets the standard Bootstrap styles for all elements</li>
13 <li>bootstrap-reboot.css. Contrary to its name, this file doesn’t reset the standard browser styles like reset.css but sets the standard Bootstrap styles for all elements</li>
14 <li>bootstrap-utilities.css. This file contains all atomic classes and Bootstrap utilities. We will study the main utilities in future lessons</li>
14 <li>bootstrap-utilities.css. This file contains all atomic classes and Bootstrap utilities. We will study the main utilities in future lessons</li>
15 <li>bootstrap.css is a compilation of all Bootstrap styles. If you need all of them, you should connect this file. This file also contains the styles for all components</li>
15 <li>bootstrap.css is a compilation of all Bootstrap styles. If you need all of them, you should connect this file. This file also contains the styles for all components</li>
16 </ul><p>Let’s create a project that uses only the grid and bootstrap utilities:</p>
16 </ul><p>Let’s create a project that uses only the grid and bootstrap utilities:</p>
17 <p>When connecting styles to a project, it’s better to use minimized versions of the files. They have a .min appendix in their name. These files are compressed, which reduces the weight of the styles.</p>
17 <p>When connecting styles to a project, it’s better to use minimized versions of the files. They have a .min appendix in their name. These files are compressed, which reduces the weight of the styles.</p>
18 <h2>Connecting using an npm package</h2>
18 <h2>Connecting using an npm package</h2>
19 <p>The last method is to connect Bootstrap using the<strong>npm</strong>package. At the same time, you’ll get access to all Bootstrap SASS files, opening up the possibility to fine-tune your project and create new components and utilities.</p>
19 <p>The last method is to connect Bootstrap using the<strong>npm</strong>package. At the same time, you’ll get access to all Bootstrap SASS files, opening up the possibility to fine-tune your project and create new components and utilities.</p>
20 <p>To install Bootstrap via the npm package, use this command:</p>
20 <p>To install Bootstrap via the npm package, use this command:</p>
21 <p>After that, the bootstrap directory will appear in the<em>node_modules</em>directory. Inside it, besides compiled CSS and JS files, there’ll be SASS files, which help to create their components or utilities.</p>
21 <p>After that, the bootstrap directory will appear in the<em>node_modules</em>directory. Inside it, besides compiled CSS and JS files, there’ll be SASS files, which help to create their components or utilities.</p>
22 <p>With this approach, developers use the SASS preprocessor. To connect Bootstrap to a file, we use the standard @import directive:</p>
22 <p>With this approach, developers use the SASS preprocessor. To connect Bootstrap to a file, we use the standard @import directive:</p>
23  
23