Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I use Grunt (http://gruntjs.com) to compile them for production.

        handlebars: {
            compile: {
                options: {
                    namespace: "JST"
                },
                files: {
                    "dist/debug/templates.js": ["templates/**/*.hbs"]
                }
            }
        },
Then you can concat templates.js with the rest of your JS and your template functions are ready to go!

https://npmjs.org/package/grunt-contrib-handlebars



For a multiple page website, it seems like it is a waste to serve up all of the templates for the entire site. I try to serve the template that is specific for the page.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: