some interesting ideas, I’ll look into these for 1.7.0 Bison Grid.
Hello @futtta, I second what @bison Grid has requested. Thank you kindly for such a great job you are doing with this plugin.
Kind regards
I’m pushing a “beta”-version of 1.6.6 out (download here), which has noptimize-support.
A simple example of JS being excluded;
<!--noptimize--><script>alert('this will not get autoptimized');</script><!--/noptimize-->
This can also be used to exclude CSS or HTML. Looking forward to your feedback!
excluding css is coming in 1.7.0 and I could use some testing-help there. 🙂
1.7.0 is live, hope you like it!
Hello @futtta, thank you for the latest release. I am currently testing it and so far it is working exceptionally well ;).
You are doing a tremendous job with this plugin. Keep up the great work.
Kind regards
- Define costum $replaceTag(s)
would be nice too.
Because sometimes ignored scripts have to load after the others in footer.
not sure what you mean Maurice, can you elaborate?
Yes sure sorry, my english skills are not so great x)
Autoptimize insert the minifyed js script just before </body> as defined in autoptimizedScript.php right? But if there is an script that have to be ignored and placed in the site after the others to work, there is no way without changing your plugin files.
Edit:
<!– here I want autoptimize output –>
<script type=”my ignored special script”… />
</body>
</footer>
OK. The “ignored special script”, in the original HTML, is already at the bottom, or elsewhere?
In my example it is already there. This script includes tabbed widgets, some slider and other miscellaneous stuff, normally located in the head placed by the themes author. Unfortunately it only works if I add it to the ignored scripts in autoptimize settings and if the other scripts, here combined and minified by autoptimize, are loaded(?) before.
But there could be tons of other reasons to define the place where autoptimze output its awesome job even for the css output. And in my first suggestion I didn’t consider that simple HTML comments like <!–AutoptimzeJS–> as optional alternate tags to define that output places would exactly do what I was searching for. Sorry for the wall of text.
I see. You mentioned “changing your plugin files”, did you do that already and if so, how?
I changed </body> with <!--autoptimize--> in autoptimize / classes / autoptimizeScripts.php on line 214 and my themes footer looks now
</footer>
<!--autoptimize--> // here comes the autoptimize output
<script bla bla bla /> // thats the ugly ignored script
</body>
</html>
But I dont know how exactly its search for the defined tag to make an <!--autoptimize--> ELSE </body> so I have to add the html comment in the theme or it will not work.
OK, think I understand what you want to achieve, I’ve added it to the wishlist (but will probably take some time before this is in a release).
Well, 1.8.0-test has just been published and it comes with an API that allows you to specify scripts that should be loaded after the optimized file. There’s example code in the included autoptimize_helper.php_example;
add_filter('autoptimize_filter_js_movelast','my_ao_override_movelast',10,1);
function my_ao_override_movelast($movelast) {
$movelast[]="console.log";
return $movelast;
}
Looking forward to your feedback!