Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

minit_exclude_js & re-enqueue back to header #96

Open
omniacode opened this issue Nov 29, 2016 · 3 comments
Open

minit_exclude_js & re-enqueue back to header #96

omniacode opened this issue Nov 29, 2016 · 3 comments
Assignees
Labels

Comments

@omniacode
Copy link

Hello -

I stumbled upon this plugin looking for a real way to compile both css & js files into single files to reduce the amount of requests being made by WP themes, and I have to say I like where this project is going :)

However, I am messing around with the minit_exclude_js filter and I hate to sound like such a n00b, but I wanted to use the filter to exclude jquery core & jquery-migrate because it is seemingly breaking every site I install the plugin on. As I am sure you already know that most themes do not follow great standards, but by using the filter it moves both files to the footer which still causes issues with jquery placed within the page by plugins and what not.

Is there a way to exclude these two files and re-enqueue them back into the header? I know it sounds quite counter productive, but even doing so still eliminates 20+ requests per theme.

Thanks

@GermontZ
Copy link

GermontZ commented Nov 29, 2016

Try this.
add_filter( 'minit-exclude-js', 'exclude_my_file' );
add_filter( 'minit-exclude-css', 'exclude_my_file' );
function exclude_my_file( $exclude ) {
// ID of the script that was enqueued
$exclude[] = 'jquery';
$exclude[] = 'jquery-migrate';
return $exclude;
}

Other than that, see also my issue about the same topic: #57

@omniacode
Copy link
Author

@GermontZ -

Thanks for the reply, however I did try the suggested filter, however by doing so it removes the files that are excluded from the head section and places them right above the minit async call in the footer.

I even tired to use wp_deregister_script & wp_register_script to try and force it back into the head section with no luck.

I'll hold off on this for now until some type of work around pops up. Thanks.

@kasparsd kasparsd added the bug label Dec 21, 2018
@kasparsd kasparsd self-assigned this Dec 21, 2018
@kasparsd
Copy link
Owner

Confirmed the bug locally -- the filter does exclude the file but it doesn't print it out in the header.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants