docs: better document for partial lookups, closes #165

harttle
2020-03-03 00:41:39 +08:00
parent e7a7861b96
commit 1412ca289a
+8 -3
@@ -47,14 +47,19 @@ var engine = new 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):
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:
- `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):
If none of the above files exists, an `ENOENT` error will be throwed. Here's a demo for Node.js: [demo/nodejs](https://github.com/harttle/liquidjs/tree/master/demo/nodejs).
- `https://harttle.com/bar/foo.liquid`
When LiquidJS is used in browser, say current location is <https://example.com/bar/index.html>, only the first `root` will be used and the file to be fetched is:
- <https://example.com/bar/foo.liquid>
If fetch fails, a 404/500 error or network failures for example, an `ENOENT` error will be throwed.
Here's a demo for browsers: [demo/browser](https://github.com/harttle/liquidjs/tree/master/demo/browser).
## Abstract File System