Dan Ramos
Dan Ramos

Reputation: 1102

Configuring backbone and grunt+yeoman to use jade

I'm new to the whole yeoman and grunt scene and I want to know how I can use Jade templates for my backbone views. I downloaded the yeoman backbone generator and ran yo backbone:view email. The generator then created this email-view.js file:

/*global define*/

define([
    'jquery',
    'underscore',
    'backbone',
    'templates',
], function ($, _, Backbone, JST) {
    'use strict';

    var EmailView = Backbone.View.extend({
        template: JST['app/scripts/templates/email.ejs']
    });

    return EmailView;
});

Along with an empty email.ejs file. Is there a way I can get use jade as my templating engine? Is it something I have to set up in my Gruntfile?

Upvotes: 1

Views: 543

Answers (2)

maethorr
maethorr

Reputation: 594

I haven't used the backbone generator but you can update the yeoman's live reload to compile jade templates as per the instruction below:

https://gist.github.com/kevva/5201657

After you made the changes above to Gruntfile.js, the idea is after you use 'yo backbone:view email' you then need to update the generated ejs file to jade manually.

Upvotes: 0

RSK
RSK

Reputation: 17516

Jade is not supported by backbone generator at present. You can open an feature request on Github.

Right now backbone generator supports only ejs, mustache and handlebars templates.

Upvotes: 1

Related Questions