0

I have come across quite a number of articles that indicate I need to explicitly bundle each jQueryUI .css file, e.g. the accepted answer to How to add jQueryUI library in MVC 5 project?. Yet when I look at the .css files in the Content/themes/base folder created by Nuget, I see the file all.css, which effectively includes all the other files.

It seems much simpler to me to just bundle the all.css file, but I'm wondering whether the css @import directives used in this file will still work as expected in a script bundle.

Community
  • 1
  • 1
ProfK
  • 49,207
  • 121
  • 399
  • 775

1 Answers1

0

As far as I know, adding reference to jquery.ui.all.css does the trick.

However, I would say that most of the time the whole library is not needed. Being explicit in your initial config (i.e. adding each used style reference) will make it easy to later remove/comment references that you don't need or use. It will also make it much easier for other developers to identify what references are really included in that bundle.

One small caveat regarding the naming of jquery ui style bundles:

[..] you need to make sure your CSS bundle names are similar to the physical directory structure of your application. When installing the jQuery UI nuget package, it will put your stylesheets in the directory /content/themes/base/ so you should name your bundle "~/content/themes/base/jqueryui" to make sure that everything [sprites/images] works.

Mackan
  • 6,200
  • 2
  • 25
  • 45