How hard would it be to get the js helper auto loaded javascript output to use a minified file extension (.min.js) and also work with Bastians’ cache buster plugin?
Right now, only the plain JS helper works with the cachebuster.
I would like the helper to use minified file extensions if a config variable is set to true. That way, it can be set in a config for the live domain whilst the local config does not use minified files.
I could provide a PR for this. I like the first option the most but everything has its pros and cons.
But actually I’m not sure if this is something that would get into the core. @lukasbestle@bastianallgeier?
@lukaskleinschmidt Any chance you could patch it up for current Kirby. I am using your version of the cachebuster plugin that does not require changing .htacess. I get the same error with Bastians original CacheBuster.
Duh. Of course. I added that, however, I get a new whoops now on the same line
Undefined variable: file
$file is set inside the cachebuster plugin. It’s as if its not being passed through to the js-component.php.
Is this a load order issue? Both these plugins extend \Kirby\Component\JS. How does it decide which one to run first, or does that even matter? It’s odd because it works fine with slightly earlier versions of Kirby. I think 2.5.4 was the last version I used it with.
And since both component extends the original Kirby component, the function of the class that is loaded last overwrites the other. You can see which version is used by dumping:
dump(kirby::instance()->component('js'));
Since you get the error message, that will be the Lukas Kleinschmitt one. Maybe you didn’t use @auto JS when it worked?
ooo! so close… except its reversed things. Now only the auto-loaded file is cachebusted and the other files are not. I think its time for bed. I’ll come back to it with fresh eyes tomorrow. Thank you @texnixe so far.
p.s i think you are using Bastians cachebuster rather then this one
No, of course not, I was using @lukaskleinschmidt plugin, not the cachebuster. This is not surprising, since that code does not handle non auto files::
@texnixe Of course, it cancels the plugin out. Sorry, it’s late, my brain is dead. I thought you were using it becuase of the way filename was constructed, because @lukaskleinschmidt CacheBuster uses a query string to avoid .htaccess edits, whereas Bastians modified the filename.
Your amended version works great, thank you so much.