I have a scripts/partials/validate,js
file and would like to load it only in specific routes.
But adding this file like that: import '../partials/validate.js'
at the top of my home.js
make it load in all other pages.
I have a scripts/partials/validate,js
file and would like to load it only in specific routes.
But adding this file like that: import '../partials/validate.js'
at the top of my home.js
make it load in all other pages.
The route files themselves will be loaded on all pages, but the init
and finalize
methods will only run on the relative route.
Change your validate file so that it won’t run when you import it. Maybe make it a function or a class. Then you can call it inside of init
or finalize
.
This topic was automatically closed after 42 days. New replies are no longer allowed.