In keystone js you could do something like
if user && user.canAccessKeystone
script(src='/keystone/js/content/editor.js')
to load a script if a certain condition is met. Would it be possible to conditionally load a script only in a certain view, i.e. in the "post" view?
something like this:
if view = post
script(src='myscript.js')
Found out that there is no need to load the script in the default.pug
file. It can be loaded in the view file (i.e. post-pog
) inside a block.js
so that the script is loaded after the scripts in the default.pug
file. Like this:
extends ../layouts/default
block content
//-this is where the content of post.pug file lives
block js
script(src='myscript.js')