Resource Path Problem

@tpbradley @ben I was using a src="{{page.resourcesPath}}/… for a script call in the Body End section. I then tried moving the script into the Template area:

@portal(bodyEnd, includeOnce: true)
<script type="text/javascript" src="{{page.resourcesPath}}/...
</script>
@endportal

I looked at the page array and for some weird reason resourcesPath isn’t in there (I’m still on v0.7.7)

It’s throwing an error, so what variable can I use to get the path to resources?

Hi @Bill,

We’ve renamed the property to better describe what it’s referring to. The new variable is {{page.projectResourcesPath}} and it’s available in build 0.7.9.

I’m not sure when it happened, but the {{page.resourcesPath}} was broken in a previous build.

You’ll also need to make the page object available to the template using the hooks file. Something like this.

const transformHook = (rw) => {
    // Make page object available to the template
    rw.setProps({
        page: rw.page
    });
}

exports.transformHook = transformHook;
1 Like