mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
docs: make it clear for extnames, see #214
This commit is contained in:
@@ -43,11 +43,11 @@ LiquidJS 把这个选项默认值设为 <code>true</code> 以兼容于 shopify/l
|
||||
**extname** 定义了默认的文件后缀,当传入文件名不包含后缀时自动追加。默认值是 `''` 也就是说默认是禁用的。如果设置为 `.liquid`:
|
||||
|
||||
```liquid
|
||||
{% render "foo" %} 会加载 foo.liquid
|
||||
{% render "foo.html" %} 会加载 foo.html
|
||||
{% render "foo" %} 没有后缀,添加 ".liquid" 并加载 foo.liquid
|
||||
{% render "foo.html" %} 已经有后缀了,直接加载 foo.html
|
||||
```
|
||||
|
||||
{% note info Legacy Versions %}
|
||||
{% note info 旧版行为 %}
|
||||
在 2.0.1 之前,<code>extname</code> 默认值为 `.liquid`。要禁用它需要明确设置为 <code>extname: ''</code>。详情参考 <a href="https://github.com/harttle/liquidjs/issues/41" target="_blank">#41</a>。
|
||||
{% endnote %}
|
||||
|
||||
|
||||
@@ -25,6 +25,10 @@ color: 'red' shape: 'circle'
|
||||
color: 'yellow' shape: 'square'
|
||||
```
|
||||
|
||||
{% note tip ".liquid" 文件扩展名 %}
|
||||
如果设置了 `extname: ".liquid"` 选项,就可以省略 <code>layout</code>, <code>render</code> 和 <code>include</code> 里面文件名的 ".liquid" 后缀。详情请参考 <a href="./options.html#extname">extname 选项</a>。
|
||||
{% endnote %}
|
||||
|
||||
## 布局模板(模板继承)
|
||||
|
||||
对于如下两个模板文件:
|
||||
|
||||
Reference in New Issue
Block a user