access scope in liquidjs filter
HTML
<script src="https://cdn.jsdelivr.net/npm/liquidjs/dist/liquid.browser.min.js"></script>
<div id="log"></div>
JavaScript
const { Liquid } = liquidjs
const engine = new Liquid()
engine.registerFilter('fullURL', function(path) {
return new URL(path, this.context.get(['origin'])).toString()
})
const tpl = `{{ '/index.html' | fullURL }}`
const scope = { origin: 'https://liquidjs.com' }
const html = engine.parseAndRenderSync(tpl, scope)
log(html)
function log(text) {
document.querySelector("#log").innerText += text + '\n';
}