How to include BootStrap 4 in Asp.Net Core Project Using Libman

Asp.Net Core project's template includes BootStrap 3.3.7 file in the project. Project uses bower to include Bootstrap files. Microsoft has shipped released version of Libman with Visual Studio 15.9 version. MS recommends using Libamn to include client side libraries in your project. If you look at the documentation of Libman, it provides a sample of how to include Bootstrap 3.3.7 in your project. Sample uses cdnjs provider to get Bootstrap 3.3.7. If you try to replace 3.3.7 with 4.2.1, you will get build error telling you that bootstrap@4.2.1 could not be resolved. If you search cdnjs as of today, you will not find Bootstrap library. But you will find twitter-bootstrap library name. That is the name you will be using in your Libman file. Following snippet shows how this section will look like in your Libman configuration in your project.

{
      "provider": "cdnjs",
      "library": "twitter-bootstrap@4.2.1",
      "destination": "wwwroot/lib/bootstrap/"
    }

If you are having similar issue with some other libraries, best thing to do is search in cdnjs for that library. If it is available then use that name in your Libman configuration file.

comments powered by Disqus

Blog Tags