Skip to content

Commit e6e85f9

Browse files
committed
feat: Define path to your templates in your reptar.config.js file.
BREAKING CHANGE: You no longer define the location to your templates in your theme file. You now must define that location in reptar.config.js under the path object.
1 parent 7c052e4 commit e6e85f9

14 files changed

Lines changed: 7 additions & 5 deletions

File tree

lib/config/config-example.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ module.exports = {
2222
path: {
2323
source: './',
2424
destination: './_site',
25+
templates: './_templates',
2526
themes: './_themes',
2627
data: './_data',
2728
},

lib/config/config-schema.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default Joi.object({
1313
.default('./'),
1414
destination: Joi.string()
1515
.default('./_site'),
16+
templates: Joi.string()
17+
.default('./_templates'),
1618
themes: Joi.string()
1719
.default('./_themes'),
1820
data: Joi.string()

lib/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ export default class Reptar {
149149

150150
this.renderer.update({
151151
noTemplateCache: this.options.noTemplateCache,
152-
templatePaths: this.theme.config.path.templates,
153152
});
154153

155154
// Expose site data from config file.

lib/renderer/renderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default class Renderer {
1818
this._config = config;
1919
}
2020

21-
update({ noTemplateCache, templatePaths }) {
21+
update({ noTemplateCache }) {
2222
// Create markdown engine.
2323
this._md = createMarkdownEngine(this._config.get('markdown.options'));
2424

@@ -27,7 +27,7 @@ export default class Renderer {
2727
// Configure template engine.
2828
this._nunjucksEnv = configureTemplateEngine({
2929
config: this._config,
30-
paths: templatePaths,
30+
paths: this._config.get('path.templates'),
3131
noCache: noTemplateCache,
3232
});
3333

test/fixtures/simple-site/expected/reptar.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ module.exports = {
1717
path: {
1818
source: './',
1919
destination: './_site',
20+
templates: './_templates',
2021
themes: './_themes',
2122
data: './_data',
2223
},

test/fixtures/simple-site/src/_themes/one/templates/_loop.html renamed to test/fixtures/simple-site/src/_templates/_loop.html

File renamed without changes.

test/fixtures/simple-site/src/_themes/one/templates/_pagination.html renamed to test/fixtures/simple-site/src/_templates/_pagination.html

File renamed without changes.

test/fixtures/simple-site/src/_themes/one/templates/base.html renamed to test/fixtures/simple-site/src/_templates/base.html

File renamed without changes.

test/fixtures/simple-site/src/_themes/one/templates/index.html renamed to test/fixtures/simple-site/src/_templates/index.html

File renamed without changes.

test/fixtures/simple-site/src/_themes/one/templates/page.html renamed to test/fixtures/simple-site/src/_templates/page.html

File renamed without changes.

0 commit comments

Comments
 (0)