Reader small image

You're reading from  Bootstrap for ASP.NET MVC - Second Edition

Product typeBook
Published inSep 2016
Reading LevelIntermediate
Publisher
ISBN-139781785889479
Edition2nd Edition
Languages
Right arrow
Author (1)
Pieter van der Westhuizen
Pieter van der Westhuizen
author image
Pieter van der Westhuizen

Pieter van der Westhuizen is a freelance software and web developer specializing in ASP.NET MVC, web technologies, and MS Office development. He started his career in web development using classic ASP, Visual InterDev, HoTMetaL, and FrontPage. Pieter has over 16 years of experience in the IT industry and is also one of the people fortunate enough to have his hobby become his full-time profession. He is also a technology evangelist for Add-in Express (www.add-in-express.com), which focuses on tools for Microsoft Office integration. This is Pieter's second book and he has been blogging since 2007 on his personal blog at www.mythicalmanmoth.com and on the Add-in Express blog since 2010. He lives with his wife and two dogs in Pretoria, South Africa.
Read more about Pieter van der Westhuizen

Right arrow

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:

  1. 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.

  2. Add font-awesome as a dependency to the file. The complete listing of the bower.json file is as follows:

             { 
               "name": "asp.net", 
               "private": true, 
               "dependencies": { 
               "bootstrap": "v4.0.0-alpha.3", 
               "font-awesome": "4.6.3" 
               } 
             } 
    
  3. Visual Studio will download the Font Awesome source files and add a font-awesome subfolder to the wwwroot/lib/ folder inside your project.

  4. Copy the fonts folder located under wwwroot/font-awesome to the wwwroot folder.

  5. Next, open the bootstrap.scss file located in the wwwroot/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";  
    
  6. 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>
Previous PageNext Page
You have been reading a chapter from
Bootstrap for ASP.NET MVC - Second Edition
Published in: Sep 2016Publisher: ISBN-13: 9781785889479
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 €14.99/month. Cancel anytime

Author (1)

author image
Pieter van der Westhuizen

Pieter van der Westhuizen is a freelance software and web developer specializing in ASP.NET MVC, web technologies, and MS Office development. He started his career in web development using classic ASP, Visual InterDev, HoTMetaL, and FrontPage. Pieter has over 16 years of experience in the IT industry and is also one of the people fortunate enough to have his hobby become his full-time profession. He is also a technology evangelist for Add-in Express (www.add-in-express.com), which focuses on tools for Microsoft Office integration. This is Pieter's second book and he has been blogging since 2007 on his personal blog at www.mythicalmanmoth.com and on the Add-in Express blog since 2010. He lives with his wife and two dogs in Pretoria, South Africa.
Read more about Pieter van der Westhuizen