Skip to content

Instantly share code, notes, and snippets.

@notduncansmith
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notduncansmith/c6aa797625831b0eed3e to your computer and use it in GitHub Desktop.
Save notduncansmith/c6aa797625831b0eed3e to your computer and use it in GitHub Desktop.
Dynamic template globals in Summit
Summit = require 'summit'
app = new Summit()
router = app.router()
router.get '/', (respond, views) ->
respond views.app
router.get '/theme/:theme', (app, req) ->
app.templateGlobals.theme = req.params.theme
Summit.redirect '/'
app.start()
{{!-- views/app.hbs --}}
{{#if theme}}
<p>The current theme is {{theme}}.</p>
{{else}}
<p>No theme configured.</p>
{{/if}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment