.NET Core MVC fallback-href for resources to multiple files?

Viewed 276

Is there any way to do this? For production I am concatting and minifying all my css and js into one file each while in dev I just have the normal separate files. But in the classic fallback href example in the documentation they only allow you to provide one href:

<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/css/bootstrap.min.css"
  asp-fallback-href="~/lib/bootstrap/css/bootstrap.min.css"
  asp-fallback-test-class="hidden" 
  asp-fallback-test-property="visibility" 
  asp-fallback-test-value="hidden" />

Which doesn't work if you are concatting files for production. I know you can also do some globbing like this:

<script asp-src-include="~/app/**/*.js"></script>

But doesn't seem like you can combine the two. Is there anyway to do this?

1 Answers

I would only bundle custom js files, and keep all the js libraries as they are.

Almost always they will be loaded/cached from the CDN anyway. This is what you want since it saves the most loading time on average.

The question is - when will there be problems loading a file from the cdn? Usually only when a firewall blocks those requests, may it be during development or using the software locally in intranet. If you know your software will only be working in situations without internet, then removing the cdn version and bundling them all the together will be your best option.

Related