Skip to main content

Posts

Showing posts from February, 2014

Handlebars integration with Yeoman’s webapp-generator

I was looking for an instruction on how to add Handlebars to my application based on Yeoman’s webapp-generator. There is an instruction on the old wiki on GitHub, but it’s out-of-date. For this exercise I’ve been using Yeoman 1.1.2 and the 0.47 version of the webapp-generator. First off, go ahead with step 1 and 2 (but obviously using the latest versions). There’s no need to load the "grunt-contrib-handlebars" in your Gruntfile.js (step 3), as "require('load-grunt-tasks')(grunt);" is used to load all referenced tasks. I did some changes to the file structure in step 4, but I guess that’s a matter of taste? One thing to note is the change from “temp” to “.tmp” as this is the temporary directory name being used in other places: handlebars: { compile: { files: { '.tmp/scripts/compiled-templates.js': [ '<%= yeoman.app %>/templates/**/*.hbs' ] }, options: { namespace: 'MyApp.Templates...