diff --git a/Render-a-File.md b/Render-a-File.md index bd044e8..1a59229 100644 --- a/Render-a-File.md +++ b/Render-a-File.md @@ -42,10 +42,20 @@ It can be a string-typed path (see above example), or a list of root directories ```javascript var engine = new Liquid({ // relative paths will be resolved against `pwd` - root: ['views/', 'views/partials/'] + root: ['views/', 'views/partials/'], + extname: '.liquid' }); ``` +When `{% render "foo" %}` is renderd or `liquid.renderFile('foo')` is called, the following files will be looked up and the first existing file will be used (if none of them exists an `ENOENT` error will be throwed): + +- `pwd`/views/foo.liquid +- `pwd`/views/partials/foo.liquid + +When LiquidJS is used in browser, say current location is `https://harttle.com/bar/index.html`, only the first `root` will be used and the file to be fetched is (if fetch fails an `ENOENT` error will be throwed): + +- `https://harttle.com/bar/foo.liquid` + ## Abstract File System LiquidJS defines an abstract file system interface in [src/fs/ifs.ts][ifs] and the default implementation is [src/fs/node.ts][fs-node] for Node.js and [src/fs/browser.ts][fs-browser] for the browser bundle.