{"action":"opened","issue":{"url":"https://api.github.com/repos/markusjwetzel/laravel-handlebars/issues/5","labels_url":"https://api.github.com/repos/markusjwetzel/laravel-handlebars/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/markusjwetzel/laravel-handlebars/issues/5/comments","events_url":"https://api.github.com/repos/markusjwetzel/laravel-handlebars/issues/5/events","html_url":"https://github.com/markusjwetzel/laravel-handlebars/issues/5","id":88177187,"number":5,"title":"Pre-compile constants on serverside","user":{"login":"markusjwetzel","id":6650637,"avatar_url":"https://avatars.githubusercontent.com/u/6650637?v=3","gravatar_id":"","url":"https://api.github.com/users/markusjwetzel","html_url":"https://github.com/markusjwetzel","followers_url":"https://api.github.com/users/markusjwetzel/followers","following_url":"https://api.github.com/users/markusjwetzel/following{/other_user}","gists_url":"https://api.github.com/users/markusjwetzel/gists{/gist_id}","starred_url":"https://api.github.com/users/markusjwetzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/markusjwetzel/subscriptions","organizations_url":"https://api.github.com/users/markusjwetzel/orgs","repos_url":"https://api.github.com/users/markusjwetzel/repos","events_url":"https://api.github.com/users/markusjwetzel/events{/privacy}","received_events_url":"https://api.github.com/users/markusjwetzel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-14T12:26:32Z","updated_at":"2015-06-14T12:26:32Z","closed_at":null,"body":"For now we can pre-compile language variables on serverside (when option `$translate_raw_output` is `true`) and then output the raw template with compiled language variables. This is helpful, because language variables are unlikely to change and otherwise we would have to pass all language variables to clientside and compile them on clientside each time we use the template.\r\n\r\nThe same is true for some other variables. For example we have a post comment form, which shows the current logged in user. The current logged in user will be the same over the whole page. So it would be nice to compile all user information on clientside and deliver the raw template with compiled user information to the client.\r\n\r\nSolution:\r\n* Add a new helper function `{{const var}}` or `{{fix var}}`, where `var` can be any variable that should be compiled on serverside even for raw output (e. g. `{{const username}}`).\r\n* Rename option `$translate_raw_output` to `$prepare_raw_output`, so this option refers to language AND constant variable compilation."}}