Compiling WordPress Scripts breaking UIKit elements


When I take my site out of development mode and check "Select to compile scripts." certain UIKit elements stop working. I started another thread in regard to inline SVG not working, but now I noticed my tabs aren't working either.

The UIKit elements are installed correctly and work just fine as long as I stay in dev mode. But once I compile the scripts, they don't work at all. I tried both standard and aggressive compiling and I flushed the assets cache but nothing helps.

Any help to point me in the right direction to troubleshoot this would be appreciated!

Thank you.


Update: the reason for this error is that JQuery is not being loaded. I disabled all plugins and removed any custom functions but I still can't resolve this. I even tried re-installing beans.

I see this was an issue a few years back from this thread: https://community.getbeans.io/discussion/jquery-doesnt-load-when-development-mode-disabled/ but I'm not including any custom scripts as was the issue here. It's UiKit that can't access jQuery. I am getting this error:

Uncaught Error: UIkit 2.x requires jQuery

I am including my UiKit components like this:

add_action( 'beans_uikit_enqueue_scripts', 'ly_add_uikit_components' );

function ly_add_uikit_components() {

    beans_uikit_enqueue_components( array( 'utility', 'flex', 'dropdown', 'toggle', 'switcher', 'tab' ) );
    beans_uikit_enqueue_components( array( 'slider', 'slidenav' ), 'add-ons' );

}



Hi Christoph,

Is there any update on what I can do to fix this on my installation? My site is getting close to launch and I can't compile the scripts without breaking the site. I was able to fix this by creating a completely new installation and importing my posts/pages via xml, but this is now happening in the new installation as well. I took a look at the issue on Github, but I'm not clear where we are on this.

Thank you. Laura


Hi Laura,

I would add the changes to class-beans-compiler.php code from https://github.com/Getbeans/Beans/pull/334/files to your Beans parent theme.

Even if Thierry or Tonya wanted changes to that code, the functionality will be the same. In other words, the next Beans update might use a slightly different code but will not break your website.


Hi Christoph,

Am I just supposed to replace my class-beans-compiler.php file with the new one at your link? I did this and there is no change. I flushed the assets cache and have set the level of compilation to standard. Is there anything else that I need to do to see a change?

Thank you, Laura



Hi Christoph,

Yes, I did this, but nothing has changed. I have the same problem. What am I missing?


Hi Christoph,

Sorry to write again, but I am using Beans in a client project that is getting ready to launch and I can't get this resolved. I've replaced the file but nothing at all has changed and I am not sure what to do. Can I launch with this in development mode until I can get this resolved? My site is hosted with Flywheel, if that is helpful.

Any advice would be much appreciated! Laura



Thanks Christoph, it seems to be working now.


Thanks for the feedback, Laura!

Write a reply

Login or register to write a reply, it's free!