xp-forge / frontend

Web frontends
1 stars 1 forks source link

Introduce globals, which are passed to the template context #16

Closed thekid closed 3 years ago

thekid commented 3 years ago

Passing a map to the frontend constructor will merge this map into the template context:

new Frontend(
  new HandlersIn('com.example.skills.web'),
  new Handlebars($this->environment->path('src/main/handlebars')),
  ['assets' => '/assets/'.$fingerprint]
)

The previous parameter here was base, a string which would be passed as "base" in the template context. If a string is used, this behavior is retained.

See https://github.com/xp-forge/frontend/issues/15#issuecomment-812842250