Adding FE JS to each Page

19 views
Skip to first unread message

Philip Cox

unread,
May 25, 2018, 8:51:49 AM5/25/18
to Keystone JS
Hello

I have recently started using Keystone. I am wondering how we can add a specific JS file to a View/Page? I can see I could extend the JS block in the template and include a file, but then that would load up a JS file with each request. Is there an example around of using Webpack to bundle all the JS and place that bundle default index template?

Thank you

Philip Cox

unread,
May 25, 2018, 12:01:53 PM5/25/18
to Keystone JS
So, I used the block js content to include a script tag pointing to a JS file.

Philip Cox

unread,
May 26, 2018, 12:58:22 PM5/26/18
to Keystone JS
It seems however, this still does not work. The JS runs before the site has loaded, so I am getting errors saying the document or window does not exist.

Still looking for help on how to run JS files on a page, please.
Reply all
Reply to author
Forward
0 new messages