Skip to content
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.

Tag Helpers: Create an 'environment' Tag Helper #1553

Closed
@DamianEdwards

Description

@DamianEdwards

A new Tag Helper that utilizes the conditional content mode (aspnet/Razor#221) to only render its contents if the current IHostingEnvironment.EnvironmentName matches the specified name. The target environment names can be specified as a comma separated list via the names attribute (string). In the case of the environment not currently matching, the contents would not even be executed.

Usage

<environment names="">
</environment>

If the names attribute is omitted, the contents are always rendered.

Attributes

Attribute Name Type Details
names string A comma separated list of environment names in which the content should be rendered

Example

<environment names="Development">
    <script src="~/js/file1.js"></script>
    <script src="~/js/file2.js"></script>
</environment>
<environment names="Staging,Production">
    <script src="~/js/site.js"></script>
</environment>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions