Reader small image

You're reading from  Bootstrap 4 Cookbook

Product typeBook
Published inJun 2017
Reading LevelBeginner
PublisherPackt
ISBN-139781785889295
Edition1st Edition
Languages
Right arrow
Author (1)
Ajdin Imsirovic
Ajdin Imsirovic
author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic

Right arrow

Chapter 11. Bootstrap 4 with ASP.NET Core

In this chapter, we will cover the following topics:

  • Starting a project in ASP.NET Core and Bootstrap 4 in Visual Studio 2017
  • Migrating the default web page of a .NET Core project from Bootstrap 3 to Bootstrap 4
  • Working with Bower, Sass, and Grunt in our .NET Core project

Starting a project in ASP.NET Core and Bootstrap 4 in Visual Studio 2017


In this recipe, we will make a new project in ASP.NET Core and Bootstrap 4. We will use Visual Studio 2017 Community Edition.

Getting ready

To get ready for this recipe, you need to have Visual Studio 2017 installed on your computer. You also need to have .NET Core installed.

Note

To make sure that you have all the needed installations, check out https://www.microsoft.com/net/core#windowsvs2017.

Visual Studio 2017 is installed via Visual Studio Installer. In order to install the .NET Core workload, you need to run the Visual Studio Installer as an administrator (with administrator privileges). Once the Installer starts, click on the Modify button on the Visual Studio 2017 Community Edition section of the installer. Under Workloads, scroll down to the very bottom and locate the .NET Core cross-platform development, which can be found in the Other Toolsets section. Click on it, and your download should start. Note that the...

Migrating the default web page of a .NET Core project from Bootstrap 3 to Bootstrap 4


In this recipe, we will fix the default web page of a .NET Core project. Why do we need to fix it? The reason is simple: after updating our Bootstrap to version 4 (instead of the default version 3), the HTML structure needs to be changed as well. We will do it in this recipe.

Getting ready

To begin, it would be worthwhile to digress from our current project and open a new .NET Core web application in Visual Studio 2017. Next, to preview the way the default web application should look out of the box (using Bootstrap 3), we will utilize Shift + Ctrl + W. This is the View in Browser command, which will, by default, open our project in the Edge browser.

The website should look like this:

Previewing the default web application in the browser

So, we have the navbar, a carousel component, four columns with some headings and lists, and finally, a footer.

Now that we know what the desired result should be, it's...

Working with Bower, Sass, and Grunt in our .NET Core project


There is a major difference between NuGet and Bower. NuGet, as the package manager used to control .NET libraries, cannot deal with static frontend libraries, such as Bootstrap or Tether. However, when working on .NET Core web applications, we need to include these libraries. That is where Bower comes into play, and it is the reason why we had to use Bower in our previous recipes, when we set up our simple app.

In other chapters of this book, we used to install Bower using Node Package Manager (NPM). In this recipe, we will let Visual Studio manage Bower for us, as it comes preinstalled with .NET Core and can be accessed via the Manage Bower Packages command. However, contrary to the previous chapters, in this chapter we will also use the bower.json file, which is used to list dependencies we use in our project. The way that bower.json file works is quite similar to the way that the package.json file is used by Grunt--it simply...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Bootstrap 4 Cookbook
Published in: Jun 2017Publisher: PacktISBN-13: 9781785889295
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Ajdin Imsirovic

Ajdin Imsirovic is a full-stack web developer who has published several courses on the subject of web design and web development. He has also authored three books, Bootstrap 4 Cookbook, Elm Web Development, and Vue.js Quick Start Guide. In his fourth book, Vue CLI 3 Quick Start Guide, he introduces readers to the rich ecosystem of frontend tooling and best practices.
Read more about Ajdin Imsirovic