Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Installing Bootstrap via NPM | Setting Up Environment
Bootstrap Essentials for Modern Websites

book
Installing Bootstrap via NPM

Installing Bootstrap via NPM allows us to manage dependencies more efficiently and integrate Bootstrap into the project build process.

Here's how to install Bootstrap via NPM:

  • In the terminal we should run the following command:

  • After installing Bootstrap, we can include the Bootstrap CSS and JavaScript files in the HTML file or import them into the JavaScript files as needed;

  • For example, we can import Bootstrap's CSS and JS in the main HTML file (e.g., index.html) using:

html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Bootstrap Example</title>
<!-- Include Bootstrap CSS -->
<link
rel="stylesheet"
href="node_modules/bootstrap/dist/css/bootstrap.min.css"
/>
</head>
<body>
<button class="btn btn-primary">Click me</button>

<!-- Include Bootstrap JS -->
<script src="node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

Note

In this course, we will utilize CDN links to integrate Bootstrap features into the project. This method eliminates the necessity of managing complex dependencies.

However, if you prefer working on your local machine using NPM, that's perfectly acceptable. Subsequent topics will function identically regardless of how you connect Bootstrap to your project.

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 2. Luku 3

Kysy tekoälyä

expand
ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

some-alt