From d48979465f47dd486d8fa9caa2bd870baed352a2 Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Fri, 12 Apr 2019 23:35:20 -0700 Subject: [PATCH 1/7] Update express-handlebars.js --- lib/express-handlebars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/express-handlebars.js b/lib/express-handlebars.js index 9e17181..c9f1795 100644 --- a/lib/express-handlebars.js +++ b/lib/express-handlebars.js @@ -26,7 +26,7 @@ function ExpressHandlebars(config) { extname : '.handlebars', layoutsDir : undefined, // Default layouts directory is relative to `express settings.view` + `layouts/` partialsDir : undefined, // Default partials directory is relative to `express settings.view` + `partials/` - defaultLayout : undefined, + defaultLayout : 'default', helpers : undefined, compilerOptions: undefined, }, config); From 489e8d8df78a72fb3561dff45233c6b7171aa65c Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Wed, 8 May 2019 15:29:31 -0700 Subject: [PATCH 2/7] Update express-handlebars.js --- lib/express-handlebars.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/express-handlebars.js b/lib/express-handlebars.js index c9f1795..d6832f3 100644 --- a/lib/express-handlebars.js +++ b/lib/express-handlebars.js @@ -26,7 +26,7 @@ function ExpressHandlebars(config) { extname : '.handlebars', layoutsDir : undefined, // Default layouts directory is relative to `express settings.view` + `layouts/` partialsDir : undefined, // Default partials directory is relative to `express settings.view` + `partials/` - defaultLayout : 'default', + defaultLayout : 'main', helpers : undefined, compilerOptions: undefined, }, config); From cf09e20d8e58bd933bc1c489730a6b70e46f96a9 Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Tue, 14 May 2019 09:57:02 -0700 Subject: [PATCH 3/7] Update server.js --- examples/advanced/server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/examples/advanced/server.js b/examples/advanced/server.js index ca0efb3..e91e4c7 100644 --- a/examples/advanced/server.js +++ b/examples/advanced/server.js @@ -10,7 +10,6 @@ var app = express(); // Create `ExpressHandlebars` instance with a default layout. var hbs = exphbs.create({ - defaultLayout: 'main', helpers : helpers, // Uses multiple partials dirs, templates in "shared/templates/" are shared From ebbb00329e0768f96581466f55404d22f1716149 Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Tue, 14 May 2019 09:57:31 -0700 Subject: [PATCH 4/7] Update server.js --- examples/basic/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/basic/server.js b/examples/basic/server.js index b266db7..538e631 100644 --- a/examples/basic/server.js +++ b/examples/basic/server.js @@ -5,7 +5,7 @@ var express = require('express'), var app = express(); -app.engine('handlebars', exphbs({defaultLayout: 'main'})); +app.engine('handlebars', exphbs()); app.set('view engine', 'handlebars'); app.get('/', function (req, res) { From 3334f4f1242569cecd042b73091d0fd89ae1c0ea Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Tue, 14 May 2019 10:03:03 -0700 Subject: [PATCH 5/7] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c2c9a1..7f8cfab 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ var exphbs = require('express-handlebars'); var app = express(); -app.engine('handlebars', exphbs({defaultLayout: 'main'})); +app.engine('handlebars', exphbs()); app.set('view engine', 'handlebars'); app.get('/', function (req, res) { @@ -124,6 +124,8 @@ The main layout is the HTML page wrapper which can be reused for the different v ``` +You can use a different name for the default layout when registering Handlebars by passing the `defaultLayout` option, e.g. `exphbs({defaultLayout: 'name'})`. + **views/home.handlebars:** The content for the app's home view which will be rendered into the layout's `{{{body}}}`. From e7e11949db13a4b38834c418d0d28812ca2ffeac Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Tue, 14 May 2019 10:05:19 -0700 Subject: [PATCH 6/7] Update README.md --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f8cfab..52713a1 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,6 @@ The main layout is the HTML page wrapper which can be reused for the different v ``` -You can use a different name for the default layout when registering Handlebars by passing the `defaultLayout` option, e.g. `exphbs({defaultLayout: 'name'})`. **views/home.handlebars:** @@ -358,7 +357,7 @@ The string path to the directory where the partials templates reside or object w **Note:** Multiple partials dirs can be used by making `partialsDir` an array of strings, and/or config objects as described above. The namespacing feature is useful if multiple partials dirs are used and their file paths might clash. #### `defaultLayout` -The string name or path of a template in the `layoutsDir` to use as the default layout. This is overridden by a `layout` specified in the app or response `locals`. **Note:** A falsy value will render without a layout; e.g., `res.render('home', {layout: false});`. +The string name or path of a template in the `layoutsDir` to use as the default layout. `main` is used as the default. This is overridden by a `layout` specified in the app or response `locals`. **Note:** A falsy value will render without a layout; e.g., `res.render('home', {layout: false});`. #### `helpers` An object which holds the helper functions used when rendering templates with this `ExpressHandlebars` instance. When rendering a template, a collection of helpers will be generated by merging: `handlebars.helpers` (global), `helpers` (instance), and `options.helpers` (render-level). This allows Handlebars' `registerHelper()` function to operate as expected, will providing two extra levels over helper overrides. From 87f7c11ff5199256794ac32842fdbe19a6d9c714 Mon Sep 17 00:00:00 2001 From: Jordan Brennan Date: Tue, 14 May 2019 10:38:58 -0700 Subject: [PATCH 7/7] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 52713a1..88da7d6 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,6 @@ The main layout is the HTML page wrapper which can be reused for the different v ``` - **views/home.handlebars:** The content for the app's home view which will be rendered into the layout's `{{{body}}}`.