Skip to content

Instantly share code, notes, and snippets.

@benfavre
Last active May 7, 2020 17:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benfavre/7ccc15a759f30acc3f48ac4d4dc5d579 to your computer and use it in GitHub Desktop.
Save benfavre/7ccc15a759f30acc3f48ac4d4dc5d579 to your computer and use it in GitHub Desktop.
// wd-faq/assets/js/faq-main.js
jQuery(document).ready(function(){
setTimeout(() => init(), 0);
});
function initFaq(){
console.log('Faq booted');
}
// wd-scripts/assets/js/scripts-main.js
import('../../wd-faq/assets/js/faq-main.js')
<?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(....);
}
}
<?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