From 8896617d1b5db8f4c58c08a4fb7361ce9e55281a Mon Sep 17 00:00:00 2001 From: Sean Fridman Date: Tue, 7 Apr 2015 22:18:48 -0400 Subject: Use correct extension for Liquid templates --- app/node_modules/oktemplate/index.js | 7 ++++--- examples/templates/index.liquid | 14 ++++++++++++++ examples/templates/index.mustache | 13 ------------- examples/templates/page.liquid | 5 +++++ examples/templates/page.mustache | 5 ----- examples/templates/project.liquid | 2 ++ examples/templates/project.mustache | 2 -- 7 files changed, 25 insertions(+), 23 deletions(-) create mode 100644 examples/templates/index.liquid delete mode 100644 examples/templates/index.mustache create mode 100644 examples/templates/page.liquid delete mode 100644 examples/templates/page.mustache create mode 100644 examples/templates/project.liquid delete mode 100644 examples/templates/project.mustache diff --git a/app/node_modules/oktemplate/index.js b/app/node_modules/oktemplate/index.js index 75d7e6f..09a78bf 100644 --- a/app/node_modules/oktemplate/index.js +++ b/app/node_modules/oktemplate/index.js @@ -26,7 +26,7 @@ liquid.registerFilters({ function OKTemplateRepo(options) { options = options || {}; this._root = options.root || 'templates'; - this._ext = options.ext || '.mustache'; + this._extPattern = options.ext || '.+(liquid|html)'; this._cache = {}; this._populateCache(this._cache); } @@ -42,9 +42,10 @@ OKTemplateRepo.prototype.getTemplate = function getTemplate(name) { */ OKTemplateRepo.prototype._populateCache = function _populateCache(cache) { var self = this; - var files = glob.sync(this._root + '/*' + this._ext); + var files = glob.sync(this._root + '/*' + this._extPattern); files.forEach(function eachFile(file) { - var name = path.basename(file, self._ext); + var ext = path.extname(file); + var name = path.basename(file, ext); var templateString = fs.readFileSync(file, {encoding: 'UTF8'}); cache[name] = { name: name, diff --git a/examples/templates/index.liquid b/examples/templates/index.liquid new file mode 100644 index 0000000..21d8764 --- /dev/null +++ b/examples/templates/index.liquid @@ -0,0 +1,14 @@ + + + + + + + {{meta.project}} + + + diff --git a/examples/templates/index.mustache b/examples/templates/index.mustache deleted file mode 100644 index 9933064..0000000 --- a/examples/templates/index.mustache +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - {{meta.project}} - - - diff --git a/examples/templates/page.liquid b/examples/templates/page.liquid new file mode 100644 index 0000000..f7d899f --- /dev/null +++ b/examples/templates/page.liquid @@ -0,0 +1,5 @@ +woop +

{{page.title}}

+

+ {{page.body}} +

diff --git a/examples/templates/page.mustache b/examples/templates/page.mustache deleted file mode 100644 index f7d899f..0000000 --- a/examples/templates/page.mustache +++ /dev/null @@ -1,5 +0,0 @@ -woop -

{{page.title}}

-

- {{page.body}} -

diff --git a/examples/templates/project.liquid b/examples/templates/project.liquid new file mode 100644 index 0000000..dac1d8d --- /dev/null +++ b/examples/templates/project.liquid @@ -0,0 +1,2 @@ +babaganuj +{{project.id}} diff --git a/examples/templates/project.mustache b/examples/templates/project.mustache deleted file mode 100644 index dac1d8d..0000000 --- a/examples/templates/project.mustache +++ /dev/null @@ -1,2 +0,0 @@ -babaganuj -{{project.id}} -- cgit v1.2.3-70-g09d2