diff --git a/demo/nodejs/index.js b/demo/nodejs/index.js index 8c2a4ff4c..130099f8d 100644 --- a/demo/nodejs/index.js +++ b/demo/nodejs/index.js @@ -10,7 +10,7 @@ engine.registerTag('header', { const [key, val] = token.args.split(':') this[key] = val }, - render: async function (scope, hash, emitter) { + render: async function (scope, emitter) { const title = await this.liquid.evalValue(this.content, scope) emitter.write(`

${title}

`) } diff --git a/demo/reactjs/package.json b/demo/reactjs/package.json index 3b9075e06..fc1e63a02 100644 --- a/demo/reactjs/package.json +++ b/demo/reactjs/package.json @@ -21,5 +21,8 @@ "not dead", "not ie <= 11", "not op_mini all" - ] + ], + "devDependencies": { + "@babel/core": "^7.8.7" + } } diff --git a/demo/typescript/index.ts b/demo/typescript/index.ts index ffb3bde3c..b496aef76 100644 --- a/demo/typescript/index.ts +++ b/demo/typescript/index.ts @@ -1,25 +1,25 @@ -import { Liquid, TagToken, Hash, Context, Emitter } from 'liquidjs' - -const engine = new Liquid({ - root: __dirname, - extname: '.liquid' -}) - -engine.registerTag('header', { - parse: function (token: TagToken) { - const [key, val] = token.args.split(':') - this[key] = val - }, - render: async function (context: Context, hash: Hash, emitter: Emitter) { - const title = await this.liquid.evalValue(this['content'], context) - emitter.write(`

${title}

`) - } -}) - -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) +import { Liquid, TagToken, Context, Emitter } from 'liquidjs' + +const engine = new Liquid({ + root: __dirname, + extname: '.liquid' +}) + +engine.registerTag('header', { + parse: function (token: TagToken) { + const [key, val] = token.args.split(':') + this[key] = val + }, + render: async function (context: Context, emitter: Emitter) { + const title = await this.liquid.evalValue(this['content'], context) + emitter.write(`

${title}

`) + } +}) + +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)