Use asp-href-include on a link element to select stylesheet files with a globbing pattern. Pair it with asp-href-exclude when a directory contains unwanted variants. section 26.4.2
Select one Bootstrap stylesheet
In Views/Shared/_SimpleLayout.cshtml, set asp-href-include="/lib/bootstrap/css/*.min.css" and exclude reboot, grid, utilities, and RTL variants. Restart ASP.NET Core, request /home/list, and inspect the response HTML; the generated output contains a link for bootstrap.min.css. section 26.4.2
Table 26.6. The built-in tag helper attributes for link elements (view table figure)
| Name |
Description |
|---|---|
| asp-href-include |
This attribute is used to select files for the href attribute of the output element. |
| asp-href-exclude |
This attribute is used to exclude files from the href attribute of the output element. |
| asp-append-version |
This attribute is used to enable cache busting, as described in the “Understanding Cache Busting” sidebar. |
| asp-fallback-href |
This attribute is used to specify a fallback file if there is a problem with a CDN. |
| asp-fallback-href-include |
This attribute is used to select files that will be used if there is a CDN problem. |
| asp-fallback-href-exclude |
This attribute is used to exclude files from the set that will be used when there is a CDN problem. |
| asp-fallback-href-test-class |
This attribute is used to specify the CSS class that will be used to test the CDN. |
| asp-fallback-href-test-property |
This attribute is used to specify the CSS property that will be used to test the CDN. |
| asp-fallback-href-test-value |
This attribute is used to specify the CSS value that will be used to test the CDN. |
Compare stylesheet-selection attributes with cache-busting and CDN-fallback attributes available on link elements. section 26.4.2
