interesting fengerzh…
some questions:
* do you see an error in your browser console?
* when comparing the JS before optimization with the one after, what differences do you see?
* do you happen to have example-code which does not require jquery? does optimizing that fail as well?
* could you create a small fiddle on http://jsfiddle.net (and post the link here) with the simplest example possible (which breaks when optimized)?
frank
1. I did not see any error in browser console.
2. I found there is a space missed in the optimized code.
The original code is as below: (please change the ‘ to backticks, I cannot put it here)
$(‘.act-container .proj-card[data-act_date!=${dateSelected}]’).hide();
After optimize, it became this:
$(‘.act-container.proj-card[data-act_date!=${dateSelected}]’).hide();
You can notice there is a space is missing.
3. I create a small piece of code in jsfiddle: https://jsfiddle.net/6jhcpeLL/
OK, I have a fix on the development version of AO. I’ve also issued a pull request against Mr Clay’s jsmin-php, which is the JS minifier that AO uses, as it’s in that component where the fix actually is applied.
If you want, you can download what will essentially become AO 2.0.3 from GitHub and overwrite wp-content/plugins/autoptimize/ with the contents of autoptimize-master/ from the zipfile. Let me know if that fixes things for you!
frank
Yes, that solved the problem. Great!
I just backported Mr. Clay’s more elaborate fix, would be great if you could re-download the to-be 2.0.3 & test that as well fengerzh to be sure all is well?