Merge branch 'bin'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Tj Holowaychuk · committed by Tj Holowaychuk · parents 704e9c1, da8d036 · Browse files · 3 files·+73 added−23 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+73 added−23 removed
- other:+73 added−23 removed
Provenance
- Commit
c0f9642- Tree
15a2b4d- Author
Tj Holowaychuk <tj@vision-media.ca>- Committer
Tj Holowaychuk <tj@vision-media.ca>- Parent 1
704e9c1- Parent 2
da8d036
3 files changed+73 added−23 removed
modified:bin/express+72 added-22 removed
31 unmodified lines32 33 var cssEngine;34 35 /**36+ * Template engine to utilize.37+ */38+39+var templateEngine = 'jade';40+41+/**42 * Usage documentation.43 */44 45 var usage = ''46 + '\x1b[1mUsage\x1b[0m: express [options] [PATH]\n'47 + '\n'48 + '\x1b[1mOptions\x1b[0m:\n'43- + ' -s, --sessions Add session support\n'44- + ' -c, --css ENGINE Add stylesheet ENGINE support (less|sass). Defaults to plain css\n'45- + ' -v, --version Output framework version\n'46- + ' -h, --help Output help information\n'49+ + ' -s, --sessions Add session support\n'50+ + ' -t, --template ENGINE Add template ENGINE support (jade|ejs). Defaults to jade\n'51+ + ' -c, --css ENGINE Add stylesheet ENGINE support (less|sass). Defaults to plain css\n'52+ + ' -v, --version Output framework version\n'53+ + ' -h, --help Output help information\n'54 ;55 56 /**57 * Jade layout template.1 unmodified line59 60 var jadeLayout = [61 '!!!'62 , 'html'56- , ' head'57- , ' title= title'58- , ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'59- , ' body!= body'63+ , ' head'64+ , ' title= title'65+ , ' link(rel=\'stylesheet\', href=\'/stylesheets/style.css\')'66+ , ' body!= body'67 ].join('\n');68 69 /**70+ * Jade index template.71+ */72+73+var jadeIndex = [74+ 'h1= title'75+ , 'p Welcome to #{title}'76+].join('\n');77+78+/**79+ * EJS layout template.80+ */81+82+var ejsLayout = [83+ '<!DOCTYPE html>'84+ , '<html>'85+ , ' <head>'86+ , ' <title><%= title %></title>'87+ , ' <link rel=\'stylesheet\' href=\'/stylesheets/style.css\' />'88+ , ' </head>'89+ , ' <body>'90+ , ' <%- body %>'91+ , ' </body>'92+ , '</html>'93+].join('\n');94+95+/**96+ * EJS index template.97+ */98+99+var ejsIndex = [100+ '<h1><%= title %></h1>'101+ , '<p>Welcome to <%= title %></p>'102+ ].join('\n');103+104+/**105 * Default css template.106 */107 108 var css = [24 unmodified lines133 , ' :font 14px "Lucida Grande", Helvetica, Arial, sans-serif'134 ].join('\n');135 136 /**95- * Jade index template.96- */97-98-var jadeIndex = [99- 'h1= title'100- , 'p Welcome to #{title}'101-].join('\n');102-103-/**137 * App test template.138 */139 140 var appTest = [35 unmodified lines176 , '// Configuration'177 , ''178 , 'app.configure(function(){'179 , ' app.set(\'views\', __dirname + \'/views\');'147- , ' app.set(\'view engine\', \'jade\');'180+ , ' app.set(\'view engine\', \':TEMPLATE\');'181 , ' app.use(express.bodyDecoder());'182 , ' app.use(express.methodOverride());:SESS:CSS'183 , ' app.use(app.router);'184 , ' app.use(express.staticProvider(__dirname + \'/public\'));'52 unmodified lines237 args.length238 ? (cssEngine = args.shift())239 : abort('--css requires an argument');240 break;241+ case '-t':242+ case '--template':243+ args.length244+ ? (templateEngine = args.shift())245+ : abort('--template requires an argument');246+ break;247 default:248 path = arg;249 }250 }41 unmodified lines292 write(path + '/public/stylesheets/style.css', css);293 }294 });295 mkdir(path + '/views/partials', function(){296+ switch (templateEngine) {297+ case 'ejs':298+ write(path + '/views/layout.ejs', ejsLayout);299+ write(path + '/views/index.ejs', ejsIndex);300+ break;301+ case 'jade':257- write(path + '/views/layout.jade', jadeLayout);258- write(path + '/views/index.jade', jadeIndex);302+ write(path + '/views/layout.jade', jadeLayout);303+ write(path + '/views/index.jade', jadeIndex);304+ break;305+ }306 });307 mkdir(path + '/test', function(){308 write(path + '/test/app.test.js', appTest);309 });12 unmodified lines322 app = app.replace(':SESS', sessions323 ? '\n app.use(express.cookieDecoder());\n app.use(express.session());'324 : '');325 326+ // Template support327+ app = app.replace(':TEMPLATE', templateEngine);328+329 write(path + '/app.js', app);330 331 // Suggestions332 process.on('exit', function(){2 unmodified lines335 , cssEngine336 , cssEngine);337 }338 console.log(' - make sure you have installed %s: \x1b[33m$ npm install %s\x1b[0m'289- , 'jade'290- , 'jade');339+ , templateEngine340+ , templateEngine);341 });342 });343 }344 81 unmodified linesmodified:support/connectnot shown
Its text is not shown, modified.
modified:package.json+1 added-1 removed
7 unmodified lines8910111212131415162 unmodified lines7 unmodified lines { "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com" }, { "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" }, { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" } ], "dependencies": { "connect": ">= 0.2.6" }, "dependencies": { "connect": ">= 0.2.7" }, "keywords": ["framework", "sinatra", "web", "rest", "restful"], "directories": { "lib": "./lib/express" }, "scripts": { "test": "make test" }, "bin": { "express": "./bin/express" },2 unmodified lines