Hello Joaquim,
Yes, as I stated in my original post, these optimization plugins will not minify the code of inline JS in order to avoid breaking code that may potentially depend on line and/or character position to perform correctly.
What I have been doing is I minify the code after I finish editing it, then insert the minified code in my AA ad. For instance, I have an ad that I use to place a widget, but the widget does not work on mobile. So the ad would be:
[widget] // this shortcode opens the widget
<!-- display: none // if user-agent contains string matching mobile's -->
<script>
var mobile = /Mobile|Tablet|SmartPhone|iP(hone|od|ad)|Android|BlackBerry|IEMobile/i.test(navigator.userAgent);
if (mobile) {
document.getElementById("widget_not_on_mobile").style.display="none";
}
</script>
However, to avoid line breaks, spaces, comments etc on the final HTML, I minify this ad’s content before saving it on Advanced Ads:
[widget]<script>var mobile=/Mobile|Tablet|SmartPhone|iP(hone|od|ad)|Android|BlackBerry|IEMobile/i.test(navigator.userAgent);mobile&&(document.getElementById("widget_not_on_mobile").style.display="none")</script>
I have other ads that include much longer JS code, with several line breaks and comments, and I do the same to optimize them.
It would be great if AA could optionally perform this minification whenever I save the Ad, so that the Ad itself remained more readable and editable, but the output would be sent pre-minified. After the ad is minified within AA, the optimization plugins will not interfere with that. They won’t minify, but they won’t revert an existing minification either.
Thanks for taking the time to further try to help me.
CB