Skip to main content


Showing posts from June, 2014

Automatic Handlebars template compilation in WebStorm

Using WebStorm with EmberJS, I needed to precompile my Handlebars templates on the go. The Handlebars precompiler works, but using it with EmberJS requires some additional modifications, and getting it to work with directories seemed to be a bit problematic(a wildcard File Watchers issue in WebStorm). I tried to install Ember-Precompile but, being currently on Windows, I gave up because of node-gyp.js rebuild issues. Eventually I found the excellent ember-template-compiler module that did the trick for me.
Setup There are a couple of dependencies that needs to be installed to get this to work:

WebStorm and NodeJS of course.EmberJS - this is not actually a dependency, but definitely a requirement.Handlebars@1.1 - an ember-template-compiler dependency.Walk - used to traverse the directories where the templates are situated. My template file structure looks like the following:

I needed to compile those templates into a single templates.js file to be included in my project. To do that I …