Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Raul P.

    (@alignak)

    Hi,

    You have to look at the status page for the logs.

    For the JS files, plugins can enqueue files either in the header or footer.
    Those in the header, are merged into one request it seems.
    In the footer you have 2… which usually means you have a set of JS files, then some external js script (some cdn, or whatever) OR some file in the ignore list, and finally another set of JS files.

    A developer would find out which file in the middle is causing the merging, dequeue it, and then enqueue it again after all other JS files.
    Doing this would prevent the splitting and all JS files in the footer should be merged.

    The other possible way, are JS files separate for mobile and desktop.
    If you have files that load only on mobile and others that load only on desktop, or files that load conditionally based on the browser, etc… that’s also going to generate multiple JS files.

    With the CSS is exactly the same.
    You most probably have a mobile only CSS file somewhere, so at least 2 CSS files are expected. As for 6 files, it’s again dequeuing those in the middle and send them to the end. It could be fonts, or some cdn or something else.

    If you want to try a few things you can:

    a) For the CSS, you could choose to inline it (I usually do this).

    b) For the CSS where your files use a CDN or some external domain, try to add that domain to the Pro tab. There’s a section there to fetch and merge those files if they are simply external urls (add one domain per line).

    c) The same can be done in the Pro Tab for the JS external files.

    Note: Do not remove files from the blacklist or default ignore list. Those are there because they are known to break things, 99% of times.

    Also read the faqs:
    https://ww.wp.xz.cn/plugins/fast-velocity-minify/faq/

    And if nothing else, you need a developer to do advanced optimization and properly figure out how to enqueue and dequeue the css and js files.

    If you have hardcoded css files on the header.php… that’s wrong and won’t be detected by the plugin. They need to be enqueued (use dependencies if you need them to be at a specific position).

    Thread Starter doctordogg

    (@doctordogg)

    Hello Raul,

    I have found that the second footer’s JS file is entirely resmap.min.js from Responsive Maps plugin.
    It has been added using function wp_enqueue_script() with parameter $in_footer = true :
    http://dl4.joxi.net/drive/2018/01/08/0024/2304/1575168/68/c614b97e1a.jpg

    http://dl4.joxi.net/drive/2018/01/08/0024/2304/1575168/68/04dacf6056.jpg

    http://dl4.joxi.net/drive/2018/01/08/0024/2304/1575168/68/8ac8db506b.jpg

    But all others js files are also added by the function wp_enqueue_script() with $in_footer = true

    I can’t understand why there are TWO footer’s JS files?

    This js file does not appear in Default Ignore List or in Default Blacklist

    Any advice?

    Thanks.

    • This reply was modified 8 years, 5 months ago by doctordogg.
    • This reply was modified 8 years, 5 months ago by doctordogg.
    • This reply was modified 8 years, 5 months ago by doctordogg.
    Plugin Author Raul P.

    (@alignak)

    The reply is actually on that same image.
    There’s an external, google map api file being enqueued there.
    That will break the series of JS files.
    Try to remove that google maps api for testing and see if it works.
    If it does, move it down.

    Thread Starter doctordogg

    (@doctordogg)

    Thank you Raul,

    I have found that the reason of the ‘3 JS files’ problem is Responsive Styled Google Maps plugin.
    But I think that customizing of it is the bad idea.

    Plugin Author Raul P.

    (@alignak)

    You don’t need to customize it.

    You can simply dequeue that script by using the same handle and location, and requeue it again with an higher priority, on your theme functions.php or some custom made plugin.

    https://codex.ww.wp.xz.cn/Function_Reference/wp_dequeue_script
    https://developer.ww.wp.xz.cn/reference/functions/wp_enqueue_script/

    A developer can help you solve that, or you can try to learn and play around with the codex information.

    Thread Starter doctordogg

    (@doctordogg)

    Hello Raul,

    It is great idea! Thank you very much,
    But Responsive Styled Google Maps plugin makes me confused.

    When I remove all calling of wp_enqueue_script() function,
    for unknown reason it’s js files still remain inside the page.

    It is not problem of your plugin.

    Thank you for your help.

    πŸ˜‰

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

The topic ‘One CSS & One JS’ is closed to new replies.