mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 15:00:42 -07:00
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:
@@ -1,4 +1,4 @@
|
||||
const Liquid = require('../..')
|
||||
const Liquid = require('liquidjs')
|
||||
|
||||
const engine = new Liquid({
|
||||
root: __dirname,
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,5 @@
|
||||
<ul>
|
||||
{% for todo in todos %}
|
||||
<li>{{forloop.index}} - {{todo}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
Reference in New Issue
Block a user