Skip to content

Conformance Examples 0.1.0 — Environment Properties: assign-env

assign-env-read

An @env assignment is readable as @env/name.

Template

{{= @env/greeting = "Hello" }}{{ @env/greeting }}

Output

Hello

assign-env-visible-in-with

An @env assignment is visible inside a #with block.

Template

{{= @env/g = "Hi" }}{{#with inner }}{{ @env/g }}{{/with}}

Context

{
    "inner": {
        "z": "Z"
    }
}

Output

Hi

assign-env-accumulates-in-each

An @env assignment inside #each persists after the loop (the last value wins).

Template

{{#each items }}{{= @env/last = this }}{{/each}}{{ @env/last }}

Context

{
    "items": [
        "a",
        "b",
        "c"
    ]
}

Output

c

assign-env-shadows-property

An @env assignment shadows a registered property for the rest of the render.

Overridden @env properties

  • @env/p (element): "base"

Template

{{ @env/p }}{{= @env/p = "ovr" }}{{ @env/p }}

Output

baseovr

Source fixture: env-properties/assign-env.json