Templates
Our master page contains the following sections. In order to facilitate a client-side templating model using backbone.js
, we will split up our master page into templates.
Let's create a new folder called ./templates
and add the following files:
./templates projects.hbs project-form.hbs repositories.hbs commits.hbs issues.hbs
In order to avoid compiling the templates on demand, let's install the grunt task grunt-contrib-handlebars
, which will precompile our handlebar templates:
npm install grunt-contrib-handlebars --save-dev
We outline the grunt configuration for our handlebars compilation in the following code; it simply takes as input a template location templates/*.hbs
and compiles these templates into a single JavaScript file and stores it at public/components/vision/templates.js
.
grunt.loadNpmTasks('grunt-contrib-handlebars'); handlebars: { compile: { options: { namespace: "visiontemplates" }, files: { "public/components/vision/templates.js...