- Bootstrap for ASP.NET MVC(Second Edition)
- Pieter van der Westhuizen
- 278字
- 2021-07-08 11:26:04
Installing Font Awesome
Bootstrap 4 no longer comes bundled with the Glyphicons icon set. However, there are a number of free alternatives available for use with your Bootstrap and other projects. Font Awesome is a very good alternative to Glyphicons that provides you with 650 icons to use and is free for commercial use.
Note
Learn more about Font Awesome by visiting https://fortawesome.github.io/Font-Awesome/.
You can add a reference to Font Awesome manually, but since we already have everything set up in our project, the quickest option is to simply install Font Awesome using Bower and compile it to the Bootstrap style sheet using Gulp. To accomplish this, follow these steps:
- Open the
bower.json
file, which is located in your project route. If you do not see the file inside the Visual Studio Solution Explorer, click on the Show All Files button on the Solution Explorer toolbar. - Add
font-awesome
as a dependency to the file. The complete listing of thebower.json
file is as follows:{ "name": "asp.net", "private": true, "dependencies": { "bootstrap": "v4.0.0-alpha.3", "font-awesome": "4.6.3" } }
- Visual Studio will download the Font Awesome source files and add a
font-awesome
subfolder to thewwwroot/lib/
folder inside your project. - Copy the
fonts
folder located underwwwroot/font-awesome
to thewwwroot
folder. - Next, open the
bootstrap.scss
file located in thewwwroot/lib/bootstrap/scss
folder and add the following line at the end of the file:$fa-font-path: "/fonts"; @import "../../font-awesome/scss/font-awesome.scss";
- Run the compile-sass task via the Task Runner Explorer to recompile the Bootstrap Sass.
The preceding steps will include Font Awesome in your Bootstrap CSS file, which in turn will enable you to use it inside your project by including the mark-up demonstrated here:
<i class="fa fa-pied-piper-alt"></i>
- 大學計算機應用基礎實踐教程
- Python for Secret Agents:Volume II
- Software Testing using Visual Studio 2012
- Magento 2 Development Cookbook
- Mastering Ubuntu Server
- Mastering OpenCV 4
- Mastering Swift 2
- Reactive Android Programming
- Service Mesh實戰:基于Linkerd和Kubernetes的微服務實踐
- Kotlin Programming By Example
- 從0到1:HTML5 Canvas動畫開發
- PyQt編程快速上手
- Building Business Websites with Squarespace 7(Second Edition)
- Java編程指南:語法基礎、面向對象、函數式編程與項目實戰
- Python程序設計:基礎與實踐