|
|
|
|
|
by latchkey
5024 days ago
|
|
This posting seems like basic knowledge, but I can see how people get lazy and don't do this step as part of their build process and just send things to the browser to do it for them. Part of the issue is that the default bin/handlebars script doesn't really support walking a tree and outputting a directory structure with all of the precompiled templates, but I've got my own hacked version of it which does... https://gist.github.com/3719225 handlebars ./handlebars --min --outputDir ./js/tmpl
I also have a build script setup in Eclipse so that when I save the file, it automatically builds things... (similar to this)...http://stackoverflow.com/questions/6645640/integrating-coffe... I use requirejs with a paths configuration like this: handlebars: 'handlebars.runtime-1.0.0.beta.6'
This allows me to just write this in my CoffeeScript for each page on my site... require('handlebars')
require('tmpl/org/requests')
...
requests.html(Handlebars.templates.org_requests(requests: requests)
All of this works amazingly well and has really allowed me to segment my code and templates up into little sections for reusability. Also, no need for ever loading the compiler part of handlebars in the client even during development. |
|