kasparsd / minit

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

jQuery not defined when plugin activated #56

Closed 1BJK903 closed 8 years ago

1BJK903 commented 8 years ago

Hi Kaspar,

First of all: great work man, This is by far the best plugin to combine files. Great work!

I have a problem though.. I am using Ajaxy Live Search plugin, but that one does not work anymore since I activated your plugin. I checked the console and it says (two times): ReferenceError: jQuery is not defined

Is there a way we can fix this?

PS: I also noticed that the CSS does not minify. Do we have do this manually?

kasparsd commented 8 years ago

I'm not sure why the particular plugin doesn't work. Can you please try the latest beta version of the 0.3 release https://github.com/kasparsd/minit/releases

Minit doesn't do any kind of minifaction by default. You'll need to use a filter for that, see https://bjornjohansen.no/wordpress-minify

1BJK903 commented 8 years ago

Nope... it gives me: Fatal error: Call to undefined function wp_scripts() in /home/plugins/minit-0.3-beta.1/include/minit-js.php on line 12

It's not about the plugin I am using, it's about the fact that it breaks jQuery. Is there something special I need to do to exclude the jQuery file?

szepeviktor commented 8 years ago

@1BJK903 And https://github.com/kasparsd/minit/issues/53

szepeviktor commented 8 years ago

If a WP plugin does script printing (echo "<script> ..." instead of wp_enqueue_script) moving minited scripts to the bottom triggers jQuery is not defined.

1BJK903 commented 8 years ago

@szepeviktor, so you are stating that it's the plugin who is not correctly defined and should be changed instead of Minit?

szepeviktor commented 8 years ago

Yes. I suspect script printing. Search for <script in the plugin's source code.

kasparsd commented 8 years ago

@1BJK903 @szepeviktor It appears that the "Ajaxy Live Search" plugin is doing everything correctly, see http://plugins.svn.wordpress.org/ajaxy-search-form/trunk/sf.php

I'm not sure why it would fail. Unfortunately I don't have the time to debug it.

szepeviktor commented 8 years ago

Here is the script printing: https://plugins.trac.wordpress.org/browser/ajaxy-search-form/trunk/sf.php#L1104 Possible solution to rewrite the plugin this way: https://plugins.trac.wordpress.org/browser/manual-cron/trunk/manual-cron.php#L25

kasparsd commented 8 years ago

Oh, great find @szepeviktor! That confirms it.