Skip to content

Commit

Permalink
fix: better index.d.ts and a demo
Browse files Browse the repository at this point in the history
The demo is located at demo/typescript/index.ts , working on #98
  • Loading branch information
harttle committed Feb 13, 2019
1 parent d14f185 commit 2015f68
Show file tree
Hide file tree
Showing 7 changed files with 2,300 additions and 2,292 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -12,3 +12,4 @@ build/

# editors
.*.swp
.vscode
2 changes: 1 addition & 1 deletion demo/nodejs/index.js
@@ -1,4 +1,4 @@
const Liquid = require('../..')
const Liquid = require('liquidjs')

const engine = new Liquid({
root: __dirname,
Expand Down
13 changes: 13 additions & 0 deletions demo/typescript/index.ts
@@ -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 changes: 5 additions & 0 deletions demo/typescript/todolist.liquid
@@ -0,0 +1,5 @@
<ul>
{% for todo in todos %}
<li>{{forloop.index}} - {{todo}}</li>
{% endfor %}
</ul>

0 comments on commit 2015f68

Please sign in to comment.