Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Add alternate template generators for mustache and handlebars #38

Closed
wants to merge 1 commit into from

Conversation

zeripath
Copy link
Contributor

In the comments of #20 @revathskumar asks how we could enable users of the backbone generator to use other templating engines. This patch adds pre-compilation templating for handlebars and mustache.

@revathskumar
Copy link
Member

@zeripath Thanks for the PR. will look into it and merge.

@@ -59,3 +59,16 @@ Generator.prototype.isUsingRequireJS = function isUsingRequireJS() {
var ext = this.env.options.coffee ? '.coffee' : '.js';
return (/require\.config/).test(this.read(path.join(process.cwd(), 'app/scripts/main' + ext)));
};

Generator.prototype.getTemplateFramework = function getTemplateFramework () {
if (!(require('fs').exists(path.join(process.cwd(), 'Gruntfile.js')))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zeripath I think we need to use existsSync.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commited, squashed and re-pushed ready to be pulled.

One gotcha I noted with the current implementation of this, which also
affects --test-framework is that you really have to put the '=' or else it
doesn't work. I wonder if that's something that needs to be fixed?

There's another thing I've just realised: Would you want the app/index.html
file updating to say which templating is installed?

andy

On 19 April 2013 19:42, Revath S Kumar [email protected] wrote:

In script-base.js:

@@ -59,3 +59,16 @@ Generator.prototype.isUsingRequireJS = function isUsingRequireJS() {
var ext = this.env.options.coffee ? '.coffee' : '.js';
return (/require.config/).test(this.read(path.join(process.cwd(), 'app/scripts/main' + ext)));
};
+
+Generator.prototype.getTemplateFramework = function getTemplateFramework () {

  • if (!(require('fs').exists(path.join(process.cwd(), 'Gruntfile.js')))) {

@zeripath https://github.com/zeripath I think we need to use *existsSync
*.


Reply to this email directly or view it on GitHubhttps://github.com//pull/38/files#r3879286
.

Andrew Thornton
[email protected]

Now uses existsSync rather than exists
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants