kasparsd / minit

A WordPress plugin to combine CSS and Javascript files.
GNU General Public License v2.0
286 stars 46 forks source link

Exclude JS #90

Closed charliepp closed 7 years ago

charliepp commented 7 years ago

Hey, just wanted to ask if you could help me excluding some JS that went broke after adding your plugin.

(btw. this is one of the best plugins ive ever used with wordpress! went from 8 css and 7 js to 1 css and 1js and speedscores as well as overal load speed improved like a charm)

The problem i have is that the JS i want to exclude doesnt seem to have an ID adressed to it. <script type='text/javascript' src='http://www.mypage.de/wp-content/plugins/gravityforms/js/gravityforms.min.js?ver=2.0.7.13' defer onload=''></script> html code looks like this.

There are 4 gravityforms js scripts that i probably need to exclude to make my form work again:

gravityforms/js/jquery.json.js?ver=2.0.7.13
gravityforms/js/gravityforms.min.js?ver=2.0.7.13
gravityforms/js/conditional_logic.min.js?ver=2.0.7.13
gravityforms/js/placeholders.jquery.min.js?ver=2.0.7.13

Is there any way to exclude those scripts even though they dont have an id adressed to them?

One further question (shame on my for that one) i assume i have to put the exclude filter inside my active theme functions.php - is that corect?

Hope you can help me out, Cheers Charliepp

kasparsd commented 7 years ago

@charliepp I'm sorry but I can't provide implementation support.

Scripts without IDs are added using non-standard methods and shouldn't be included in the combined Minit file.

kasparsd commented 7 years ago

i assume i have to put the exclude filter inside my active theme functions.php - is that corect?

Yes, that is correct.

kasparsd commented 7 years ago

Finally, it looks like you have another script doing some kind of JS/CSS optimization thing because I see the defer onload='' attributes on the script tags which are not there by default.

charliepp commented 7 years ago

kasparsd i thank you for that fast and satisfying answer. Great job on that plugin anyways, there are a whole bunch of sites on which i am able to use it. Thanks!

szepeviktor commented 7 years ago

If you have a development version you may use this debugger: https://wordpress.org/plugins/frontend-debugger/ By adding the ?remove-scripts GET parameter all WordPress-registered scripts will transform into a comment (and move to the bootom of the page), this way you may inspect the output easily. Keep clicking on the Highlight button on the control panel: https://wordpress.org/plugins/frontend-debugger/screenshots/