mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
perf: improve performance by 4x by simplified parseFile
- previously deprecated `getTemplate()` and `getTemplateSync()` not no longer supported - `opts` no longer support dynamic set in `parseFile()`, `renderFile()` arguments
This commit is contained in:
+4
-3
@@ -4,8 +4,8 @@ import { expect } from 'chai'
|
||||
|
||||
export const liquid = new Liquid()
|
||||
|
||||
export function render (src: string, ctx?: object, opts?: LiquidOptions) {
|
||||
return liquid.parseAndRender(src, ctx, opts)
|
||||
export function render (src: string, ctx?: object) {
|
||||
return liquid.parseAndRender(src, ctx)
|
||||
}
|
||||
|
||||
export async function test (src: string, ctx: object | string, dst?: string, opts?: LiquidOptions) {
|
||||
@@ -13,5 +13,6 @@ export async function test (src: string, ctx: object | string, dst?: string, opt
|
||||
dst = ctx as string
|
||||
ctx = {}
|
||||
}
|
||||
return expect(await render(src, ctx as object, opts)).to.equal(dst)
|
||||
const engine = opts ? new Liquid(opts) : liquid
|
||||
return expect(await engine.parseAndRender(src, ctx as object)).to.equal(dst)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user