Support » Plugin: Autoptimize » Autoptimize/Generatepress custom CSS change of specificity

  • Resolved georgstadler

    (@georgstadler)


    Hi,
    I use Generatepress with Autoptimize on my site.
    When I activate Autoptimize my custom css classes are ignored. When I target the classes in question overly specific (i.e. div.container instead of .container) my CSS will be displayed.

    My hunch is, that Autoptimize changes the order of the css files, when they are combined.

    This behavior also affected the standard CSS of generatepress in one instance.

    The page I need help with: [log in to see the link]

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

    (@optimizingmatters)

    assuming inline CSS is aggregate, no CSS is excluded and all CSS is of the same media-type, then AO does honor CSS load order. if any of these conditions is not fulfilled, order _can_ be different. some additional configuration (as in excluding or different options/ exclusions) can generally fix those issues. In your case removing wp-content/uploads from the default CSS optimization exclusion list will probably be the fix you’re looking for.

    hope this helps,
    frank

    carasmo

    (@carasmo)

    Yes, I can confirm, if the media type is the same then the load order is maintained. I don’t think it was like this before, but I could be wrong.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Nah, always has been like that @carasmo 🙂

    Thanks for the clarification.

    I think my configuration meets your criteria … but I’m double checking right now.

    I found a CSS rule from the Generatepress Theme which is also affected. So excluding “uploads” from AO does not help.

    All the affected rules are inside media queries for mobile.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    excluding “uploads” from AO does not help.

    I still see one block of inline CSS not aggregated @georgstadler which is likely the issue. Can you screenshot your AO CSS settings and post that here so I can review?

    All in German …




    Screenshot 01
    Screenshot 02
    Screenshot 03
    Screenshot 04

    • This reply was modified 3 months, 4 weeks ago by  georgstadler.
    • This reply was modified 3 months, 4 weeks ago by  georgstadler.
    Plugin Author Optimizing Matters

    (@optimizingmatters)

    OK, can you change the list of “Folgende CSS-dateien von Autoptimize aussliessen”

    removing wp-content/uploads from that list?

    Sorry, I read your recommendation backwards.
    wp-content/uploads is now removed.

    I cleared all caches.

    The issue with the theme CSS persists. (extra padding on the left of <article> in mobile view (single column)

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    weird, the inline CSS with id=”generate-style-inline-css” is still not aggregated.

    @edge22 Tom, is GeneratePress somehow stopping AO from aggregating that inline CSS?

    Hey Frank – nope, nothing in the theme should be preventing that. We’re actually using AO on our own site, so you can see it working in the source: https://generatepress.com

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    Thanks Tom.

    @georgstadler I’m at a loss as to why that inline CSS is not aggregated when wp-content/uploads is removed from teh exclusion list, but pretty sure that’s the root cause the remaining issue. As a workaround I would advice to add a specific CSS rule in Appearance -> Customize -> extra CSS with an !important flag to make sure it cannot get overwritten.

    hope this helps,
    frank

    Hi Frank & Tom!

    Thanks for your fast and friendly help!
    Greatly appreciated!!! You are awesome!!

    I’ll keep hunting for the root of this issue. Hope I discover a mistake I made somewhere.
    I’ve got custom CSS fixes in place, but for the sake of maximizing maintainability I hope to find different solution.

    Greetings from Munich!
    Georg

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome Georg, greetings from Brussels 🙂

Viewing 13 replies - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.