Compiler not disabled in development mode


Hi,

I am currently developing a child theme for a client. I put the theme in development mode under appearance > settings. However each time I make a change in the CSS it still requires me to flush the cache assets for the change to show on screen. I am currently using Beans 1.5.0.

Thanks in advance!


Hello Nick,

First off: I'm new here, so you may want to wait for someone with a bit more experience. Please keep this in mind, because everything I say may well be completely off the mark. However, I ran into the same issue you did when I updated Beans to 1.5.0.

As far as I could figure out, the issue comes from line 687 of the _Beans_Compiler class (\tm-beans\lib\api\compiler\class-beans-compiler.php):

if ( file_exists( $fragment ) )

If you are using the starter child theme as a base for your child theme, you probably have a line in your functions.php along the lines of

beans_compiler_add_fragment( 'uikit', get_stylesheet_directory_uri() . '/style.less', 'less' );

As far as I can tell, all these fragments are passed to the Beans Compiler when it is constructed, and if your child theme is set up as assumed, the fragment is stored with reference to its URL. When the compiler gets to the previously mentioned if statement, it'll be checking file_exists with a URL, while it seems to need a local path to work (if passed a URL it always returns false, therefore skipping the next lines, which would change the modification time, which in turn is needed when computing the new hash to see if the file has been changed).

Changing the line mentioned earlier to

beans_compiler_add_fragment( 'uikit', get_stylesheet_directory() . '/style.less', 'less' );

i.e. without the _uri, the issue seems to be solved, but, and this is a big but, I have no idea what other issues this may cause you. It may well solve one issue and end up giving you a whole lot more. This may be of some use to the folks maintaining Beans to maybe find the source of the issue a bit quicker and work in an actual solution, but in the meantime, it may solve your issue, as well.

Again, though, note that I'm not very experienced at all, so take everything I say with a grain of salt.

Have a nice day!

Cheers, Dominik


Hi Dominik,

Thanks for the tip. I tried it but unfortunately it didn't work for my particular case. As you said it solved the issue, while causing a bunch of others.

I hope this issue gets patched soon!

Thanks for the help!



Hello @xenonbart,

Thank you for identifying this bug, Nick. The Compiler should recompile the LESS files when in development mode. But we have an old bug that forces you to flush the compiler.

I pushed a change to fix it. It will be included in Beans 1.5.1, which will be out this week.

I want to give a little bit more information to help anyone reading this thread to better understand the Compiler.

The Compiler has a few jobs:

  • When in development mode, it compiles the LESS and converts it into CSS.
  • When not in development mode, it also combines all of the CSS into one file and minifies it. For the scripts, it combines all of those into one script file and minifies it too.

Thank you again, Nick, for bringing this bug to our attention.

Cheers, Tonya


Thanks so much for trhe update Tonya,

Has anyone had any success using Beans in Live mode with a Varnish Cache layer on top?

Write a reply

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