• Resolved Will Stocks

    (@willstockstech)


    Hi Frank,

    I enabled the Super PWA plugin today to test it out and as part of doing so I excluded the \wp-content\plugins\super-progressive-web-apps\ folder as a whole, just to prevent any potential conflicts/issues (shouldn’t be any, but as I’m just testing).

    However, when I sit and look at Chrome’s console, I’m seeing:
    SuperPWA service worker ready - autoptimize_single_2c986d3e9a58fc60f524c135d382591f.js:1

    Which is being generated via /wp-content/plugins/super-progressive-web-apps/public/js/register-sw.js – therefore why is this being Autoptimized when I’ve excluded that folder? Do I need to declare the “full path”?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Evening Will;
    AO 2.4.x will minify excluded JS (and CSS) if not minified yet (based on filename). This will result in excluded files being called from AO’s cache as /wp-content/cache/autoptimize/js/autoptimize_single_<hash>.js. But if things break or if you don’t want that, you can disable it with the code snippet you can find in the AO FAQ.

    hope this clarifies,
    frank

    Thread Starter Will Stocks

    (@willstockstech)

    Ahhhh, ok so it’s just a minified version of the file – and only that one file?

    Is it possible to exclude on an individual basis, or is it “turn off” the whole functionality?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Is it possible to exclude on an individual basis, or is it “turn off” the whole functionality?

    well, the filter looks like this;
    apply_filters( 'autoptimize_filter_js_minify_excluded', true, $url )

    so although I don’t have an example, you _could_ turn this on/ off based on the URL of the excluded files 🙂

    Thread Starter Will Stocks

    (@willstockstech)

    Ahhh, amazing OK I will give that a whirl to see what happens 🙂

    I assume it’s a full URL and not a relative URL?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I assume it’s a full URL and not a relative URL?

    errr, think full indeed 🙂

    Thread Starter Will Stocks

    (@willstockstech)

    Perfect, cheers Frank! I’ll give it a go in a bit! 🙂

    Thread Starter Will Stocks

    (@willstockstech)

    Last question… what would happen if I only passed a folder URL to the filter as opposed to a single file?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    that can be smart mixing & matching, similar to how you can exclude files from being aggregated; if e.g. you would create a function that hooks in that filter and you do a strpos on “wp-content/plugins” then you could stop minification if the strpos is true (or false) and that way stop/ allow minfication of a whole bunch of excluded JS (or CSS) 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Exclude folder, but JS from within still being “optimized”’ is closed to new replies.