• Hello –

    This is such a great plugin first of all, so kudos for that! But I do have a question about a few different file types.

    1. What is the procedure to exclude external files such as Google Analytics, Google Maps, Cloudflare, etc?

    For example, Google Maps seems to be included when I select “Extract JS from HTML” combining it into a single file. Assuming this is a “cache busting” file that would cause the cache to “grow quickly” due to it being a) a Google file and b) the ver=4.9.2 being appended to the end of the file. But the Cloudflare plugin also adds a file to the list: “/cdn-cgi/scripts/d07b1474/cloudflare-static/email-decode.min.js” – How do I exclude these types of files from being “extracted”?

    2. What is the expected path for say theme files & plugins? Do I put the entire relative path starting at /wp-content/?

    For example for Revolution Slider: “/wp-content/plugins/revslider/public/assets/js/jquery.themepunch.tools.min.js”

    Thanks in advance!

    • This topic was modified 6 years, 10 months ago by Jason Ryan.
Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    1. external files are never aggregated/ optimized actually, so no need to worry about those ??

    2. I would do assets/js/jquery.themepunch.tools.min.js but there’s more possibilities, have a look at the FAQ, it’s explained there ??

    hope this helps,
    frank

    Thread Starter Jason Ryan

    (@viablethought)

    Frank –

    Interesting, the first time around after enabling “Extract JS”, I swore I saw GMap JS in the aggregated file and couldn’t find it in the source code, but now I checked this morning again it’s not in there! I guess 18 hour days are wearing on me ??

    As for script exclusion, I read through the FAQ and couldn’t find info on how relative paths are entered according to theme vs. plugin files which is why I asked here. Guess I will read through again and see if I can find it.

    Additionally, there is a reason I am asking questions obviously, which is that I am having similar issues as everyone else when it comes to “Extracting JS” and the cache growing and trying to determine what is causing the “canary in the coal mine” scenario. I have done some reading of your blog posts and testing a few things and I can’t really put my finger on why the cache is getting so large in less then a week’s time. I have Cloudflare enabled but no additional caching plugin like WT3 or Super Cache, is that something I have to consider using as well?

    Thanks again in advance.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    from the FAQ;

    Both CSS and JS optimization can skip code from being aggregated and minimized by adding “identifiers” to the comma-separated exclusion list. The exact identifier string to use can be determined this way:

    if you want to exclude a specific file, e.g. wp-content/plugins/funkyplugin/css/style.css, you could simply exclude “funkyplugin/css/style.css”
    if you want to exclude all files of a specific plugin, e.g. wp-content/plugins/funkyplugin/js/*, you can exclude for example “funkyplugin/js/” or “plugins/funkyplugin”
    if you want to exclude inline code, you’ll have to find a specific, unique string in that block of code and add that to the exclusion list. Example: to exclude <script>funky_data=’Won\’t you take me to, Funky Town'</script>, the identifier is “funky_data”.

    regarding growing cache; first of all check if it’s CSS of JS by looking at the amount of files in wp-content/cache/autoptimize/js vs wp-content/cache/autoptimize/css. the easy solution in most cases is unticking the “also aggregate inline” boxes (but some themes write page-specific CSS to wp-content/uploads or wp-content/cache so that could also be the case). If JS and if you want to keep “also aggregate inline JS” active, then you would (after running them through jsbeautifier.org) have to compare 2 different JS-files for the same type of content (e.g. 2 blogposts that have different autoptimized JS). that difference should tell you what to exclude ??

    have fun!
    frank

    Thread Starter Jason Ryan

    (@viablethought)

    Hey Frank –

    Ok, I still seem to be having issues with getting this configured properly in order for it to work in my benefit. I tried “unticking” Extract JS from HTML and deleted cache and I still have the same amount of files as previous. In fact, Both CSS & JS have the same exact amount of files:

    https://screencast.com/t/QfCx6ftkbeC5

    I do use a specific plugin that adds a lot of inline CSS and JS to the HTML and using this plugin helps me to aggregate that into separate files which is nice, but with the cache growing every couple days and having to manually dump it to satisfy the warning emails, I assume there has to be a better way to configure it but I just can’t wrap my head around it. Do you have an email address so I can send additional info about the site in question so you can take a look?

    Thanks in advance.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    well, based on the screenshot you added then at least at the time you made that screenshot there did not seem to be a problem with cache size; the number of files is perfectly acceptable there.

    let’s make the same screenshot tomorrow and/or during the weekend and see what we learn from that?

    frank

    Thread Starter Jason Ryan

    (@viablethought)

    Frank –

    I had disabled all optimization but I will re-enable it now and will post back results over the weekend.

    Thanks for all of your help!

    Thread Starter Jason Ryan

    (@viablethought)

    Frank –

    Ok, well it has only been a little over a day and I got the email about cache getting too large so I just checked…

    CSS: 540 files
    JS: 541 files

    Why are so many files being created? Shouldn’t it really only be aggregating everything into two files, one for css and one for js, serving those as static cached files? I looked in a few CSS files and the contents are the same? Is a new file being generated each time a unique visitor visits the website? I am so confused as to why so many files.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Why are so many files being created?

    AO first aggregates the code (JS or CSS) and before minifying and caching it checks if for that exact string (to the comma) of aggregated code a version in cache exists. If there is a difference (even the slightest) is minifies and caches the code. the easiest solution is to make sure the two “also aggregate inline” (css or js) are unticked. additionally some themes (e.g. Divi and Avada if I’m not mistaking) by default store page-specific CSS in wp-content/uploads or wp-content/cache, so that would need to be excluded too.

    Shouldn’t it really only be aggregating everything into two files, one for css and one for js, serving those as static cached files?

    AO works through the logic I explained above on a per request basis. If two pages have different CSS or JS, you’ll end up with multiple files in cache.

    I looked in a few CSS files and the contents are the same?

    exactly the same, as in identical?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘What is the protocol to exclude certain files?’ is closed to new replies.