3

I have installed boostrap.scss nuget package into ASP.NET Core 3.1 project, but I don't see the SCSS files. Where are they?

Liero
  • 25,216
  • 29
  • 151
  • 297
  • Does this answer your question? [Razor Core installing jquery.unobtrusive.ajax missing js files](https://stackoverflow.com/questions/57012147/razor-core-installing-jquery-unobtrusive-ajax-missing-js-files). Don't be put off by jquery vs bootstrap. The underlying issue is the same. – zivkan Jan 12 '20 at 17:10
  • Hi Liero, is there any update for this issue? Please check if my answer helps to resolve your issue. We would try best to help if the issue persists to block you :) – LoLance Jan 17 '20 at 06:19
  • 1
    @LanceLi-MSFT: I've reported the issue to boostrap team here: https://github.com/twbs/bootstrap/issues/30045. Let's see if they accept is as a bug. – Liero Jan 17 '20 at 12:06

2 Answers2

1

I have installed boostrap.scss nuget package into ASP.NET Core 3.1 project, but I don't see the SCSS files.

Agree with zivkan, to make generated packages compatible with asp .net core projects (which uses PackageReference format), package authors should use contentFiles element instead of old content element when creating packages.

If the package is created using ContentFiles element + those scss files, when you consume that package in your current .net core project, you can then see those files in solution explorer. But after my check, boostrap.sass doesn't use contentfiles element in xx.nuspec file. That's why you can't see those files in solution explorer. And this is something that should be handled by package authors, we consumers can do nothing about that...

Where are they?

One nuget package(xx.nupkg) is actually a zip file. You can download it manually here

enter image description here

Rename it to xx.zip, extract it and then you can find those files in:

enter image description here

Also, since you've installed that package into current project, you can find those files in cache C:\Users\xxx\.nuget\packages\bootstrap.sass\x.x.x\contentFiles\Content\bootstrap.

In summary:

The author do include those files in the contentFiles folder when generating nuget packages. However, he also need to specify the contentFiles element in xx.nuspec file like this issue. Only one folder whose name is contentFiles in xx.nupkg is not enough if we want to access those files in VS Solution Explorer. You may need to contact the author to get further support.

halfer
  • 19,824
  • 17
  • 99
  • 186
LoLance
  • 25,666
  • 1
  • 39
  • 73
1

I am the maintainer of the Bootstrap NuGet packages. While I don't think you should be using NuGet for Bootstrap in dot net core projects, I think I've figured out how to make it work.

I am going to place the js files in the wwwroot/js and, for the non-scss Bootstrap package, css files in the wwwroot/css folder. Where do you expect the scss files to be? wwwroot/scss? /scss? Somewhere else?

Let me know and I'll publish a new version ASAP.

Supergibbs
  • 1,421
  • 3
  • 14
  • 21
  • yep, that works. Or maybe just add note to the description, that the package shouldn't be used and suggest alternative... – Liero Feb 05 '20 at 07:57
  • I'm curious - why not use the NuGet package? Seems like the least-friction if your working in VS – FrozenKiwi Feb 05 '20 at 15:56
  • NuGet is designed for compiled code (https://github.com/twbs/bootstrap/issues/16692#issuecomment-117922208), not for js/css/etc. For that, npm is a better choice. Legacy .NET Framework projects don't have great support for npm but newer core ones do. Pretty much all frontend packages use npm, but not all use NuGet. Things like https://github.com/twbs/bootstrap/issues/29770 happen. Anyway, I'll release a version that works but I encourage you to try npm for better support. Issue: https://github.com/twbs/bootstrap/issues/30045 – Supergibbs Feb 06 '20 at 17:01
  • @Liero Where do you want the scss files? – Supergibbs Feb 06 '20 at 17:09
  • wwwroot/scss is ok – Liero Feb 07 '20 at 07:49
  • @Supergibbs I think using generic folders ass css/js is not very friendly. I think wwwroot/libs/bootstrap or www/bootstrap and then css/js/sass inside those folders would be best. – Bart Calixto Mar 12 '21 at 00:00
  • Agree with @BartCalixto - all of the files in the root of the scss folder under wwwroot is terrible. – Charles Boyung Oct 26 '21 at 04:36