Support » Plugin: Autoptimize » excluding custom js file

  • Resolved asterix30

    (@asterix30)


    Hi,
    I read most of the topics on this matter here, but I still can’t bring autoptimize to exclude a custom JS file, which is needed for adblockers detection. The file ads.js is in themes/dt-the7-child/js/ads.js directory, and I want it to be excluded from processing/aggregation. When I add it excluded list and un-check aggregation, it still renames it and makes this file useless. I clear all possible caches every time, so it is not an issue.
    Any idea where to dig? I used different directory names while trying to exclude it, but nothing seems to work.

    Thank you in advance for any help!
    Alex

    • This topic was modified 2 years, 12 months ago by asterix30.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    in 2.4.0 when excluding an un-minified file, AO will keep it separate but will indeed minify it. this _should_ not break it, but if it does (can you confirm if so) then you can disable the minification of excluded JS with this code snippet;

    
    add_filter('autoptimize_filter_js_minify_excluded','__return_false');

    hope this helps,
    frank

    Thread Starter asterix30

    (@asterix30)

    Thank you for a prompt answer!
    It does not break the content of the file, that is correct, just it’s name. I will try your suggestion and come back.

    Thread Starter asterix30

    (@asterix30)

    worked like a charm! may I suggest to embed it as an option into the plugin interface? Could be very useful, I think. )))
    Anyways, appreciate your help!

    With regards, Alex.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    It does not break the content of the file, that is correct, just it’s name.

    In that case; is there a reason why you want to keep it un-minified?

    may I suggest to embed it as an option into the plugin interface?

    That idea crossed my mind as well. Might do so in the future, but currently my main goal is to find out if by default this should be off for the next minor.

    Anyways, appreciate your help!

    you’re welcome, feel free to leave a review of the plugin and support here 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘excluding custom js file’ is closed to new replies.