In this recipe, we will learn how to use the Environment, Script, and Link TagHelpers.
We will use the following TagHelpers:
- The Environment HTML tag
- In the existing Script HTML tag, some TagHelper attributes:
asp-append-version
asp-src-include
asp-fallback-test
asp-fallback-src
asp-fallback-src-include
- In the existing Link HTML tag, some TagHelper attributes:
asp-append-version
asp-href-include
asp-fallback-test-class
asp-fallback-test-property
asp-fallback-test-value
asp-fallback-href
We'll dive into using TagHelpers by creating a project that behaves differently in each Environment: Development
, Staging
, and Production
:
- First, let's use the Environment TagHelper:
<environment names="Development"> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" /> </environment> <environment names="Staging,Production"> <link rel="stylesheet" href=https://ajax.aspnetcdn.com/ajax/ bootstrap/3...