WordPress.org

Ready to get started?Download WordPress

Forums

Autoptimize
Feature request: Some extra options (16 posts)

  1. Bison Grid
    Member
    Posted 12 months ago #

    Would like to have the ability to:

    • Ignore head scripts or CSS in the head or body
    • Ignore inline scripts or CSS in the head or body
    • Override 'switches' flags to ignore processing in the HTML or scripts or CSS (e.g. <!-- Autoptimize: ignore on -->Ignore this<!-- Autoptimize: ignore off -->)

    Thanks for the good plugin so far!

    http://wordpress.org/extend/plugins/autoptimize/

  2. futtta
    Member
    Plugin Author

    Posted 12 months ago #

    some interesting ideas, I'll look into these for 1.7.0 Bison Grid.

  3. mbrsolution
    Member
    Posted 11 months ago #

    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

  4. futtta
    Member
    Plugin Author

    Posted 7 months ago #

    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!

  5. futtta
    Member
    Plugin Author

    Posted 6 months ago #

    excluding css is coming in 1.7.0 and I could use some testing-help there. :-)

  6. futtta
    Member
    Plugin Author

    Posted 5 months ago #

    1.7.0 is live, hope you like it!

  7. mbrsolution
    Member
    Posted 5 months ago #

    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

  8. Maurice
    Member
    Posted 5 months ago #

    • Define costum $replaceTag(s)

    would be nice too.
    Because sometimes ignored scripts have to load after the others in footer.

  9. futtta
    Member
    Plugin Author

    Posted 5 months ago #

    not sure what you mean Maurice, can you elaborate?

  10. Maurice
    Member
    Posted 5 months ago #

    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>

  11. futtta
    Member
    Plugin Author

    Posted 5 months ago #

    OK. The "ignored special script", in the original HTML, is already at the bottom, or elsewhere?

  12. Maurice
    Member
    Posted 5 months ago #

    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.

  13. futtta
    Member
    Plugin Author

    Posted 5 months ago #

    I see. You mentioned "changing your plugin files", did you do that already and if so, how?

  14. Maurice
    Member
    Posted 4 months ago #

    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.

  15. futtta
    Member
    Plugin Author

    Posted 4 months ago #

    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).

  16. futtta
    Member
    Plugin Author

    Posted 3 months ago #

    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!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.