Last active
May 7, 2020 17:53
-
-
Save benfavre/7ccc15a759f30acc3f48ac4d4dc5d579 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wd-faq/assets/js/faq-main.js | |
jQuery(document).ready(function(){ | |
setTimeout(() => init(), 0); | |
}); | |
function initFaq(){ | |
console.log('Faq booted'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wd-scripts/assets/js/scripts-main.js | |
import('../../wd-faq/assets/js/faq-main.js') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// wd-faq/wd-faq.php | |
function include_scripts(){ | |
if(apply_filter('wd-faq-scripts', true)){ // We add our own custom filter here so people can tell our plugin to disable script inclusions | |
wp_enqueue(....); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// wd-scripts/wd-scripts.php | |
add_filter('wd-faq-scripts', function(){ return false }); // We disable the script inclusion done in wd-faq so we can bundle it in our main.js file with parcel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment