Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add hogan.js template engine for express@3.0 #1176

Merged
merged 2 commits into from Jun 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 22 additions & 0 deletions bin/express
Expand Up @@ -19,6 +19,7 @@ program
.option('-s, --sessions', 'add session support')
.option('-e, --ejs', 'add ejs engine support (defaults to jade)')
.option('-J, --jshtml', 'add jshtml engine support (defaults to jade)')
.option('-h, --hjs', 'add hogan.js engine support')
Copy link
Member

Choose a reason for hiding this comment

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

personally i would change this to --hogan, is it referred to as hjs often?

.option('-c, --css <engine>', 'add stylesheet <engine> support (less|stylus) (defaults to plain css)')
.option('-f, --force', 'force on non-empty directory')
.parse(process.argv);
Expand All @@ -36,6 +37,7 @@ var eol = 'win32' == os.platform() ? '\r\n' : '\n'
program.template = 'jade';
if (program.ejs) program.template = 'ejs';
if (program.jshtml) program.template = 'jshtml';
if (program.hjs) program.template = 'hjs';

/**
* Routes index template.
Expand Down Expand Up @@ -122,6 +124,23 @@ var jshtmlIndex = [
, '<p>Welcome to @write(title)</p>'
].join(eol);

/**
* Hogan.js index template.
*/
var hjsIndex = [
'<!DOCTYPE html>'
, '<html>'
, ' <head>'
, ' <title>{{ title }}</title>'
, ' <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'
, ' </head>'
, ' <body>'
, ' <h1>{{ title }}</h1>'
, ' <p>Welcome to {{ title }}</p>'
, ' </body>'
, '</html>'
].join(eol);

/**
* Default css template.
*/
Expand Down Expand Up @@ -275,6 +294,9 @@ function createApplicationAt(path) {
write(path + '/views/layout.jshtml', jshtmlLayout);
write(path + '/views/index.jshtml', jshtmlIndex);
break;
case 'hjs':
write(path + '/views/index.hjs', hjsIndex);
break;

}
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -22,6 +22,7 @@
"ejs": "*",
"mocha": "*",
"jade": "*",
"hjs": "*",
"stylus": "*",
"should": "*",
"connect-redis": "*",
Expand Down