I need to load a Jquery lib only on a single page of my website. Here is the steps until now:
yarn add jquery-sticky
Inside “entry” on config.json
"jquery-sticky": [ "../../node_modules/jquery-sticky/jquery.sticky.js" ],
Inside wp_enqueue_scripts
on setup.php
if (is_page('cursos-especiais')) {
wp_enqueue_script('jquery-sticky', asset_path('scripts/jquery-sticky.js'), ['jquery'], null, true);
}
routes/page-name.js
import 'jquery-sticky';
This looks working fine, except by one detail: the sticky plugin code being added to main.js. How to avoid this?