From e387304922f6379cebebaaa511c608855d8acba1 Mon Sep 17 00:00:00 2001 From: yo mama Date: Fri, 5 Dec 2014 19:17:43 -0800 Subject: added branch ejs --- bin/app.js | 4 ++-- controllers/index.js | 2 +- package.json | 1 + views/main.ejs | 3 +++ views/partials/bottom.ejs | 2 ++ views/partials/icons.ejs | 4 ++++ views/partials/meta.ejs | 16 ++++++++++++++++ views/partials/stylesheets.ejs | 4 ++++ views/partials/top.ejs | 16 ++++++++++++++++ 9 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 views/main.ejs create mode 100644 views/partials/bottom.ejs create mode 100644 views/partials/icons.ejs create mode 100644 views/partials/meta.ejs create mode 100644 views/partials/stylesheets.ejs create mode 100644 views/partials/top.ejs diff --git a/bin/app.js b/bin/app.js index 842707f..1d4ca61 100755 --- a/bin/app.js +++ b/bin/app.js @@ -21,8 +21,8 @@ app.use(express.static('../public/vendor')); //app.use(express.favicon(__dirname + '/public/images/shortcut-icon.png')); //app.use(messages()); -app.set('view engine', 'html'); -app.set('views', __dirname + '/views'); +app.set('view engine', 'ejs'); +app.set('views', 'views'); // view caching app.set('view cache', false); diff --git a/controllers/index.js b/controllers/index.js index 71ca5d4..9bb524a 100755 --- a/controllers/index.js +++ b/controllers/index.js @@ -1,4 +1,4 @@ var rendering = require('../config/rendering'); exports.main = function(req, res) { - res.json('hello world'); + res.render('main', { foo: 'bar' }); } diff --git a/package.json b/package.json index cd5298c..804cec6 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "body-parser": "^1.10.0", "cookie-parser": "^1.3.3", "cookie-session": "^1.1.0", + "ejs": "^1.0.0", "express": "^4.10.4", "express-validator": "^2.7.0", "fs-extra": "^0.12.0", diff --git a/views/main.ejs b/views/main.ejs new file mode 100644 index 0000000..c5f2d04 --- /dev/null +++ b/views/main.ejs @@ -0,0 +1,3 @@ +<% include partials/top %> +YOO BOII! +<% include partials/bottom %> diff --git a/views/partials/bottom.ejs b/views/partials/bottom.ejs new file mode 100644 index 0000000..308b1d0 --- /dev/null +++ b/views/partials/bottom.ejs @@ -0,0 +1,2 @@ + + diff --git a/views/partials/icons.ejs b/views/partials/icons.ejs new file mode 100644 index 0000000..c8e72f9 --- /dev/null +++ b/views/partials/icons.ejs @@ -0,0 +1,4 @@ + + + + diff --git a/views/partials/meta.ejs b/views/partials/meta.ejs new file mode 100644 index 0000000..f4d29d9 --- /dev/null +++ b/views/partials/meta.ejs @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/views/partials/stylesheets.ejs b/views/partials/stylesheets.ejs new file mode 100644 index 0000000..9b51d2f --- /dev/null +++ b/views/partials/stylesheets.ejs @@ -0,0 +1,4 @@ + + + + diff --git a/views/partials/top.ejs b/views/partials/top.ejs new file mode 100644 index 0000000..8e3ef5e --- /dev/null +++ b/views/partials/top.ejs @@ -0,0 +1,16 @@ + + + + + <% if(typeof(name) !== 'undefined'){ %> + <%= name %> + <%} %> + <% if(typeof(description) !== 'undefined'){ %> + <%= description %> + <%} %> + +<% include meta %> +<% include icons %> +<% include stylesheets %> + + -- cgit v1.2.3-70-g09d2