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:
harttle
2021-09-27 23:04:41 +08:00
parent 6b9f872bcc
commit 24f5346084
14 changed files with 103 additions and 151 deletions
+2 -5
View File
@@ -76,15 +76,12 @@ describe('tags/render', function () {
})
it('should be able to access globals', async function () {
liquid = new Liquid({ root: '/', extname: '.html', globals: { name: 'Harttle' } })
mock({
'/hash.html': 'InParent: {{name}} {% render "user.html" %}',
'/user.html': 'InChild: {{name}}'
})
const html = await liquid.renderFile('hash.html', {
name: 'harttle'
}, {
globals: { name: 'Harttle' }
})
const html = await liquid.renderFile('hash', { name: 'harttle' })
expect(html).to.equal('InParent: harttle InChild: Harttle')
})