fix: better index.d.ts and a demo

The demo is located at demo/typescript/index.ts , working on #98
This commit is contained in:
harttle
2019-02-13 20:07:13 +08:00
parent d14f18520b
commit 2015f683b8
7 changed files with 2305 additions and 2297 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
const Liquid = require('../..')
const Liquid = require('liquidjs')
const engine = new Liquid({
root: __dirname,
+13
View File
@@ -0,0 +1,13 @@
import Liquid, {isTruthy} from 'liquidjs'
const engine = new Liquid({
root: __dirname,
extname: '.liquid'
})
const ctx = {
todos: ['fork and clone', 'make it better', 'make a pull request'],
title: 'Welcome to liquidjs!'
}
// console.log('isTruthy:', isTruthy('a string here'));
engine.renderFile('todolist', ctx).then(console.log)
+5
View File
@@ -0,0 +1,5 @@
<ul>
{% for todo in todos %}
<li>{{forloop.index}} - {{todo}}</li>
{% endfor %}
</ul>