Reputation: 6781
In ASP.Net core 1 projects there was a packages.json where you would manage packages like bootstrap but this file is not in my asp.net core 2 mvc project but the project came with bootstrap. I have checked the Manage Nuget and Manage Bower but both of them do not show bootstrap as an installed package. Infact they don't show anything but ASP.net core. How do I remove bootstrap from the project? And in turn how to I manage the pre-installed copies of jQuery?
Upvotes: 3
Views: 6219
Reputation: 3312
I think the better way for you is to create a empty project. There is no file in wwwrot folder and no items installed. Then after creating necessary files for your project you chose the best alternative for front-end framework like bootstrap or jquery.
Checkout this link: Client-side development in ASP.NET Core
There you can find the client-side solution may suit you better.
Upvotes: 0
Reputation: 511
You can remove any unnecessary CSS/Javascript from /path/wwwroot/css and /path/wwwroot/js, but the main directory for bootstrap/jquery is generally /path/wwwroot/lib
As for auto install/updating this, that is handled by Bower which is located in bower.json and can be removed by simply removing those dependencies.
Clarity edit:
Inside of project_folder/Views/Shared/_Layout.cshtml, remove:
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
and
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
Javascript at the bottom:
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
and
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-2.2.0.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery"
crossorigin="anonymous"
integrity="sha384-K+ctZQ+LL8q6tP7I94W+qzQsfRV2a+AfHIi9k8z8l9ggpc8X+Ytst4yBo/hH+8Fk">
</script>
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
crossorigin="anonymous"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
</script>
Inside project_folder/wwwroot/lib folder, remove all bootstrap folders, jquery folders.
Upvotes: 3
Reputation: 1642
You can manage your client side packages with Bower in ASP.NET Core by editing the bower.json file - see: https://learn.microsoft.com/en-us/aspnet/core/client-side/bower
NOTE: Just be aware that bower is not supported anymore will be depreciated in asp.net core shortly.
https://github.com/aspnet/Home/issues/2086
https://wildermuth.com/2017/11/19/ASP-NET-Core-2-0-and-the-End-of-Bower
Upvotes: 0