Skip to content

Template Destination Path and File Extension #47

@ghost

Description

I am working on using grunt with a backbone/cordova (phonegap)...

It would be nice to have a "dest_path" and "include_ext" options so you could set the destination folder of the template and whether or not to include the extension of the file name in the template name.

Example:

jst: {
     compile: {
         options: {
             prettify: true
         },
         files: {
             "www/javascripts/templates.js": ["www/javascripts/templates/*.jst.ejs"]
         }
     }
}

The end result is that each template has "www/javascripts/templates/" before each templat name:

 this["JST"]["www/javascripts/templates/modal_message.jst.ejs"] = function...

The new option would like look like:

jst: {
     compile: {
         options: {
             dest_path: "templates",
             include_ext: false,
             prettify: true
         },
         files: {
             "www/javascripts/templates.js": ["www/javascripts/templates/*.jst.ejs"]
         }
     }
}

and the end results would be:

this["JST"]["templates/modal_message"] = function...

So in backbone I can refer to the templates as such:

 this.template = JST["templates/modal_message"];

Clear as mud?

BTW, thanks for the work on this. It is going to save me a bunch of time. 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions