Hummingbird not combining as much as I thought.

Hi WPMUDEV,

Hummingbird is serving 6 combined .js files, and leaving one un-combined.

I was expecting two .js files - one in the header and one in the footer.

I'm not RTFM'ing something, I'm sure :slight_smile:

Site: http://nutcat.com.au Support access has been granted.

  • Predrag Dubajic
    • Support

    Hey Greg,

    Hope you're doing well today :slight_smile:

    Keeping minification separate in couple of files is kind of a security measure, combining all the files to one can actually cause many issues so we took more of a safe approach that gives good results with low chance of breaking things up.

    Let us know if you have any followup questions :slight_smile:

    Best regards,
    Predrag

  • Greg
    • Flash Drive

    Sorry, I should have been clearer. The source for nutcat.com.au shows two Hummingbird-generated CSS files. That's good. But one of the Hummingbird CSS files has an @import in it. Should Hummingbird be unrolling that hierarchy?

  • Milan
    • WordPress Wizard

    Hello Greg

    Hope you are well today and thanks for more insights. :slight_smile:

    Before we dig deep into this issue, I request you to update your current copy of Hummingbird to its latest version as we have recently released latest update which contains many bug fixes.

    Once you update, check the status of files and if it is still there, please let me know what are the names of that files and to which plugin/theme it belongs.

    Cheers,
    Milan

  • Milan
    • WordPress Wizard

    Hello Greg

    After your last reply, I communicated about this with our developer and he told me some key points which forces us to make our plugin does this job this way. These are,

    #1) It could be counterproductive as seving 1 very big file caould take to much to download
    #2) There are dependencies involved and HB needs to keep the files order. For example, there are some files that must be only enqueued when IE < version 9. That file will be enqueued alone. Every file enqueued after that will start a new combined file to preserve original order.

    Hope this helps you to understand why this way only. :slight_smile:
    Cheers,
    Milan

  • Greg
    • Flash Drive

    Thanks for the detailed explanation.

    Problem is, Google's Pagespeed Insights complains about the file not being minified. I know GPI isn't the be-all know-all of everything, but shouldn't the imported file still be minified?

  • Greg
    • Flash Drive

    Also, it seems clear that you and/or the developer haven't looked at my specific files. It's the @import that seems unique and doesn't seem to be intentional like some of the other scenarios your developer mentions.

  • Adam Czajczyk
    • Support Gorilla

    Hello Greg,

    I hope you're well today!

    The "@import" scenario is not uncommon. There's no need in my opinion to look at specific files at this point because similar scenario happens very often. My colleague Milan already forwarded you some explanation from the developer on why Hummingbird works this way but let me ask him (the developer) again about this specific issue - those imported styles.

    Please keep an eye on this thread and I'll update it with information as soon as I get a replay.

    Kind regards,
    Adam

  • Adam Czajczyk
    • Support Gorilla

    Hello Greg,

    I just got a response from Hummingbird developer.

    Using "@import" is not considered a "good practice", mostly because it slows down the page load speed. That's because first the CSS that contains "@import" must be loaded and then the imported file. Actually, this was a common practice when creating child-themes for WordPress but for some time already it's not suggested anymore even in WP docs. Instead the "wp_enqueue_style" should be used.

    The Hummingbird plugin indeed will not miniy files that are not registered through WordPress, as in case of "@import". The solution is to replace "@import" with WP core "wp_enqueue_style()" function:

    https://developer.wordpress.org/reference/functions/wp_enqueue_style/

    Such a solution would be fully compliant with WP Codex directives and also would make those styles ready for minification - Hummingbird will be able to include them.

    As for Google PageSpeed Insights. They are using different algorithm to "calculate/check" minified sizes. As a result they still may be showing that some minification would be required - though it's difficult to predict because it's specific to the tested site. The percentage score should however improve then.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.