- Bootstrap for ASP.NET MVC(Second Edition)
- Pieter van der Westhuizen
- 278字
- 2021-07-08 11:26:04
Adding the Bootstrap 4 files using Bower
With ASP.NET 5 and Visual Studio 2015, Microsoft provided the ability to use Bower as a client-side package manager. Bower is a package manager for web frameworks and libraries that is already very popular in the web development community.
Note
You can read more about Bower and search the packages it provides by visiting http://bower.io/.
Microsoft's decision to allow the use of Bower and package managers other than NuGet for client-side dependencies is because it already has such a rich ecosystem.
Note
Do not fear! NuGet is not going away. You can still use NuGet to install libraries and components, including Bootstrap 4!
To add the Bootstrap 4 source files to your project, you need to follow these steps:
- Right-click on the project name inside Visual Studio's Solution Explorer and select Add | New Item....
- Under .NET Core | Client-side, select the Bower Configuration File item, make sure the filename is
bower.json
and click on Add, as shown here: - If not already open, double-click on the
bower.json
file to open it and add Bootstrap 4 to the dependencies array. The code for the file should look similar to the following:{ "name": "asp.net", "private": true, "dependencies": { "bootstrap": "v4.0.0-alpha.3" } }
- Save the
bower.json
file. - Once you've saved the
bower.json
file, Visual Studio will automatically download the dependencies into thewwwroot/lib
folder of your project. In the case of Bootstrap 4 it also depends on jQuery and Tether. You'll notice that jQuery and Tether has also been downloaded as part of the Bootstrap dependency. - After you've added Bootstrap to your project, your project layout should look similar to the following screenshot:
推薦閱讀
- 精通Nginx(第2版)
- Arduino by Example
- Manga Studio Ex 5 Cookbook
- Android 9 Development Cookbook(Third Edition)
- Web Development with Django Cookbook
- 深入淺出Windows API程序設計:編程基礎篇
- 游戲程序設計教程
- Java設計模式及實踐
- Java Web開發技術教程
- Hands-On Enterprise Automation with Python.
- Hands-On Natural Language Processing with Python
- Mastering Android Development with Kotlin
- 青少年信息學競賽
- 深度學習原理與PyTorch實戰(第2版)
- 分布式架構原理與實踐