It seems unlikely that you should have 'wwwroot' in your href. Try
href="css/site5.min.css"
Test by putting the url in your browser address bar, you should see the bundled file. Use the full url for your site - www.mysite.com/css/site5.min.css
It seems unlikely that you should have 'wwwroot' in your href. Try
href="css/site5.min.css"
Test by putting the url in your browser address bar, you should see the bundled file. Use the full url for your site - www.mysite.com/css/site5.min.css
ok i tried the following :-
<link rel="stylesheet" href="/css/site5.min.css">
but still i lost all the css effects, so seems the bundle did not work. also when i access the following url i got empty page:-
https://localhost:44363/css/site5.min.css
so i am not sure why the bundle is not working? also should i physically have the site5.min.css or it will get created at runtime?
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Hi johnjohn123123.
You could download these package in nuget or add the following code to your .csproj file(double click your project name in visual studio).
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Hi johnjohn123123.
You could download these package in nuget or add the following code to your .csproj file(double click your project name in visual studio).
ok i added the code to the .csproj , build the project and run it >> but the css effect got lost + no file named
site5.min.css got created .... not sure why?
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
488 Points
2558 Posts
Bundling my CSS files is not working
May 07, 2020 01:09 PM|johnjohn123123|LINK
Inside my _Layout view i have the following css definitions:-
so i bundle them as follow:-
and i replace all the css definitions with one definition as follow:-
but i lost all the css effect on my site.. so seems the bundle is not working fine... any advice?
Participant
1620 Points
927 Posts
Re: Bundling my CSS files is not working
May 07, 2020 10:11 PM|PaulTheSmith|LINK
It seems unlikely that you should have 'wwwroot' in your href. Try
href="css/site5.min.css"
Test by putting the url in your browser address bar, you should see the bundled file. Use the full url for your site - www.mysite.com/css/site5.min.css
Member
488 Points
2558 Posts
Re: Bundling my CSS files is not working
May 07, 2020 10:47 PM|johnjohn123123|LINK
ok i tried the following :-
but still i lost all the css effects, so seems the bundle did not work. also when i access the following url i got empty page:-
so i am not sure why the bundle is not working? also should i physically have the site5.min.css or it will get created at runtime?
Contributor
2690 Points
874 Posts
Re: Bundling my CSS files is not working
May 08, 2020 03:36 AM|Rena Ni|LINK
Hi johnjohn123123,
1.Be sure download the two package like below:
2.Configure your bundleconfig.json and it should be located in your project root.:
3.Build your project,then the bundle js and css file would exist in folder :`wwwroot/css/` and `wwwroot/js/`.
4.Add reference to _Layout.cshtml:
<link rel="stylesheet" href="~/css/site5.min.css" asp-append-version="true" />
5.The project structure like below:
Best Regards,
Rena
Member
488 Points
2558 Posts
Re: Bundling my CSS files is not working
May 08, 2020 07:44 PM|johnjohn123123|LINK
from where i need to download those? i thought they already exists inside my asp.net core MVC web project?
All-Star
58204 Points
15661 Posts
Re: Bundling my CSS files is not working
May 08, 2020 08:35 PM|bruce (sqlwork.com)|LINK
As many of us don’t use them, why would they be the default?
Member
488 Points
2558 Posts
Re: Bundling my CSS files is not working
May 08, 2020 08:57 PM|johnjohn123123|LINK
you mean most users do not use bundling?
second question, from where i can download the following:-
Thanks
Contributor
2690 Points
874 Posts
Re: Bundling my CSS files is not working
May 08, 2020 11:51 PM|Rena Ni|LINK
You could download these package in nuget or add the following code to your .csproj file(double click your project name in visual studio).
Best Regards,
Rena
Member
488 Points
2558 Posts
Re: Bundling my CSS files is not working
May 09, 2020 10:21 AM|johnjohn123123|LINK
ok i added the code to the .csproj , build the project and run it >> but the css effect got lost + no file named site5.min.css got created .... not sure why?
All-Star
58204 Points
15661 Posts
Re: Bundling my CSS files is not working
May 09, 2020 03:31 PM|bruce (sqlwork.com)|LINK
I use webpack as my bundler. But if you read the libman docs, you need to install the tool
https://docs.microsoft.com/en-us/aspnet/core/client-side/libman/libman-cli?view=aspnetcore-3.1
Member
488 Points
2558 Posts
Re: Bundling my CSS files is not working
May 09, 2020 08:22 PM|johnjohn123123|LINK
but why i need to use this tool? now i download the following from NuGET
But still i did not get the bundling & minification working
All-Star
58204 Points
15661 Posts
Re: Bundling my CSS files is not working
May 10, 2020 01:44 AM|bruce (sqlwork.com)|LINK
those packages are for visual studio plugin that can bundle and minify (not libman which is a dotnet.exe plugin).
https://github.com/madskristensen/BundlerMinifier
Contributor
2690 Points
874 Posts
Re: Bundling my CSS files is not working
May 11, 2020 08:30 AM|Rena Ni|LINK
Hi johnjohn123123,
Be sure to add the relative path:
Best Regards,
Rena