Hi,
I have a few JavaScript files that must only be loaded on a specific page, eg.
- https://app/index --> load jQuery
- https://app/profile/edit --> load custom JS file
I dont want to load the commonJs files on the profile/edit page. Can this be done using assets? At the moment I have a collection that loads all my JavaScript files just before the </body> tag.
// Load this on the /index page
$this->assets
->collection('commonJs')
->addJs('js/vendor/jquery.js')
Is there a way to only load a specific collection on a route?
// Load this on the /profile/edit page
$this->assets
->collection('myJs')
->addJs('js/vendor/mine.js')
Kind Regards