From 23e7424f9d21c39ea2cd105850ab7406b6b023e5 Mon Sep 17 00:00:00 2001 From: harttle Date: Tue, 31 Oct 2017 00:10:45 +0800 Subject: [PATCH] change: default extname to `""`, working for #41 --- README.md | 2 +- index.js | 2 +- test/liquid.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e21d0ef89..d3aaf53d0 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ The full list of options for `Liquid()` is listed as following: If an array, the files are looked up in the order they occur in the array. Defaults to `["."]` -* `extname` is used to lookup the template file when filepath doesn't include an extension name. Set to `""` if you do **NOT** want liquidjs to append default extname. Defaults to `".liquid"`. +* `extname` is used to lookup the template file when filepath doesn't include an extension name. Eg: setting to `".html"` will allow including file by basename. Defaults to `""`. * `cache` indicates whether or not to cache resolved templates. Defaults to `false`. diff --git a/index.js b/index.js index 11305f6fb..e73532192 100644 --- a/index.js +++ b/index.js @@ -114,7 +114,7 @@ function factory (options) { options = _.assign({ root: ['.'], cache: false, - extname: '.liquid', + extname: '', trim_tag_right: false, trim_tag_left: false, trim_value_right: false, diff --git a/test/liquid.js b/test/liquid.js index ffcca43c8..a535cb673 100644 --- a/test/liquid.js +++ b/test/liquid.js @@ -93,7 +93,7 @@ describe('liquid', function () { .to.eventually.equal('foo') }) it('should find files without extname', function () { - var engine = Liquid({root: '/root', extname: ''}) + var engine = Liquid({root: '/root'}) return expect(engine.renderFile('/root/files/bar', ctx)) .to.eventually.equal('bar') })