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

Alternative for Environment TagHeper domain #5671

Closed
Eilon opened this issue Jan 9, 2017 · 8 comments
Closed

Alternative for Environment TagHeper domain #5671

Eilon opened this issue Jan 9, 2017 · 8 comments

Comments

@Eilon
Copy link
Member

Eilon commented Jan 9, 2017

From @vkichline on October 8, 2015 22:32

I see this pattern in the Web Application template's _ValidationScriptsPartial.cshtml:

<environment names="Development">
       …
</environment>
<environment names="Staging,Production">
       …
</environment>

This pattern above seems brittle; if I add a new environment setting, I have a lot of searching and modification to do.

I wish I had something like:

<environment names="Development">
       …
</environment>
<environment names="!Development">
       …
</environment>

…or:

<environment names="Development">
       …
<else>
       …
</environment>

Copied from original issue: aspnet/Razor#567

@Eilon
Copy link
Member Author

Eilon commented Jan 9, 2017

The <else> thing can't be done because it's not valid syntax.

But something like this can certainly be done:

<environment names="Development">
    <true></true>
    <false></false>
</environment>

@Eilon
Copy link
Member Author

Eilon commented Jan 9, 2017

(Not saying it's worth it or that it's a good idea, but it's implementable.)

@Eilon
Copy link
Member Author

Eilon commented Jan 9, 2017

Another alternative to consider would be something like:

<environment names="Development"></environment>
<environment names="Development" behavior="OppositeDay"></environment>

Or at least something like that.

@Eilon
Copy link
Member Author

Eilon commented Jan 11, 2017

Another option to consider:

Another alternative to consider would be something like:

<environment names="Development"></environment>
<environment excludeNames="Development"></environment>

And you can't set both names and excludeNames.

@DamianEdwards thoughts on this? I think this could clean up the default templates. And, of course, Hubbup.

@DamianEdwards
Copy link
Member

maybe:

<environment include="Development">
    ...
</environment>
<environment exclude="Development">
    ...
</environment>

And keep support for names as it is now.

@Eilon
Copy link
Member Author

Eilon commented Jan 11, 2017

Yeah I dig this. @danroth27 totally digs this too.

@Eilon
Copy link
Member Author

Eilon commented Jan 11, 2017

Let's go with @DamianEdwards 's suggestion in #5671 (comment).

@Eilon Eilon added this to the 2.0.0 milestone Jan 11, 2017
@grahamehorner
Copy link

grahamehorner commented Jan 20, 2017

@Eilon @DamianEdwards or maybe

options are may


<environment>
<case names="..." include=true>
</case>
<case names="..." include=false>
</case>
<default>
</default>
</environment>

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants