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

Cannot get scripts from WooCommerce to concatenate #30

Open
aj-adl opened this issue Dec 11, 2014 · 4 comments
Open

Cannot get scripts from WooCommerce to concatenate #30

aj-adl opened this issue Dec 11, 2014 · 4 comments

Comments

@aj-adl
Copy link

aj-adl commented Dec 11, 2014

I have read all through the source and cannot for the life of me work out what the heck is going on in regards to this issue - it all seems like it should work fine?

If I define a group of scripts that are enqueued by my theme or registered by default with WP it works fine, even when all dependencies are not within the same groups etc

eg: these groups are working fine.

jquery, jquery-migrate
jquery-ui-core, jquery-ui-widget, jquery-ui-tabs, jquery-ui-accordion
jq-easing, jq-hover-intent, jq-flex-slider, jq-carousel, pretty-photo, tabber, custom

Nothing at all happens when I try to add woocommerce scripts to either the above groups or in new groups - in all cases there is just silent failure to concat/minify - the scripts still get loaded individually so no site breakage it is just really frustrating not being able to work out why I cannot get these two to play together - WooCommerce registers and enqueues its scripts as it should using the correct functions and hooked to the correct action.

Has anyone else had any experience with this? I'd really like to get it working as a way around all the tiny bullshit fragmented JS files that WooCommerce uses - Apparently they would rather perform 6-8 extra http requests per page than load 1-2kb of JS that possibly doesn't get used.. /grumble

@juxprose
Copy link

Same for me. Would really like to concatenate the WooCommerce scripts.

@paplco
Copy link

paplco commented Apr 19, 2015

I had same issue. For me it came down to the code at line 370 in /class.minqueue.php

// Don't handle remote urls.
if ( 0 !== strpos( $src, home_url() ) ){
FB::log($src.", ".home_url());
// return false;
}

I used Firebug (FB::log) to log the $src and the home_url() variables because I discovered the files were being removed from the queue at that point.

The $src that woocommerce has stored is //mylaceez.com/wp-content/plugins/woocommerce/assets/js/frontend/add-to-cart.min.js
With the double slashes in front!

The home_url() function is returning: http://mylaceez.com

So the IF statement was returning false. I just commented out return false and now my WooCommerce JS and CSS files are being minified. I'll just be sure not to include any actual remote scripts or stylesheets in the queues.

If anyone can let us know why woo has double slashes on the $src, that would be cool. But also, I think home_url is the wrong function to use in the comparison, because the protocol and domain are not needed in the src to make a dependency valid as local resource.

minQueue is an awesome plug-in! First one that is working really well for me, helping to sift through all the included resources on various pages. And now that the Woo issue is handled, it's even better!

Thanks everyone! Happy coding :)

@mattheu
Copy link
Owner

mattheu commented Apr 19, 2015

Thanks for digging into this. The double slash will work regardless of whether it is http or https - so this is certainly something that should work. I'll take a look into a way to handle this.

@paplco
Copy link

paplco commented Apr 21, 2015

Glad I could help out some. Seems that just adding WooCommerce to minQueue isn't enough, breaks the site; so I left Woo .js and .css out of the queues for now. I'll be looking into why it breaks during the next iteration for the site (a few weeks from now). I'll post why when I figure it out. Thanks

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

No branches or pull requests

4 participants