mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 04:40:39 -07:00
16 lines
415 B
JavaScript
16 lines
415 B
JavaScript
const { Liquid } = require('../..')
|
|
const { readFileSync } = require('fs')
|
|
const { join } = require('path')
|
|
|
|
const liquid = new Liquid({
|
|
root: join(__dirname, '../templates'),
|
|
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)
|
|
}
|