mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-17 05:10:40 -07:00
- previously deprecated `getTemplate()` and `getTemplateSync()` not no longer supported - `opts` no longer support dynamic set in `parseFile()`, `renderFile()` arguments
17 lines
430 B
JavaScript
17 lines
430 B
JavaScript
const { Liquid } = require('../..')
|
|
const { readFileSync } = require('fs')
|
|
const { join } = require('path')
|
|
|
|
const liquid = new Liquid({
|
|
root: join(__dirname, '../templates'),
|
|
cache: true,
|
|
extname: '.liquid'
|
|
})
|
|
|
|
liquid.registerFilter('url', path => `http://example.com${path}`)
|
|
|
|
module.exports = {
|
|
load: path => liquid.parse(readFileSync(path + '.liquid', 'utf8')),
|
|
render: (tpl, data) => liquid.renderSync(tpl, data)
|
|
}
|