Support » Plugin: Autoptimize » Optionally Processing CSS through a second processor? (unused-css)

  • Resolved Mat Gargano

    (@matstars)


    I have not deeply looked into how the plugin is running code through criticalcss.com — I just know that it appears to be hooking in and running efficiently.

    I am making an assumption in how you architected the plugin, but if I think of criticalcss.com as a generic processor. E.g., it offers an API that you pass a token, it does a scan and returns back CSS that gets stored in a temporary location and enqueued (e.g. cache/autoptimize/css/autoptimize_43j0306be9822jjj3rf9a28bb74jj.css + any inlined code, etc.).

    I was wondering if (and it’s a bit if) a service existed for unused-css.com that was functionally the same mechanism as criticalcss.com if it would be possible to further filter the CSS.

    Think of it as middleware. Is there any possibility of adding an extra hop in middleware in the processing of the CSS to further refine it down, provided the service acts in a way that is similar (or adaptable) to criticalcss?

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

    (@optimizingmatters)

    short answer; yes, if such a service would exist then yes theoretically it would be possible to refine the CSS further down.

    theoretical, because:
    * quality would be even more important then with the critical CSS; with the latter we *know* that ultimately the full CSS loads, so small issues with CCSS will be corrected. with “only used CSS” every bit of CSS that was removed but turns out to be needed (e.g. for JS-drawn UI) will result in broken pages
    * as such the tool would be required to extract “used CSS” for all browsers and even take browser versions into account
    * this would probably result in different “full” css for different pages so although you would have only little “unused CSS”, that file will not be re-usable for a 2nd page so no caching can be done on it.

    Conclusion (for now); I’m not convinced this would *really* be useful/ usable I’m afraid.

    frank

    The theoretical yes was what I cared Most about.

    It sounds like you are more skeptical in unused CSS based on its ability (or inability) to account for any dynamically used/generated/extracted CSS.

    If I had a magic wand (bear with me here) and could fix all of those problems – would your comfort in its possibility of being useful rise?

    I am skeptical unused css can do it (without significant intervention on it’s processing side – eg “magic” phantom scripts that ensure it gets all css at a minimum) – but I want to understand if that’s more your concern, which it sounds like it is, is that correct?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    It sounds like you are more skeptical in unused CSS based on its ability (or inability) to account for any dynamically used/generated/extracted CSS.

    that and lack of reuseability (from cache) of the usedCSS-optimized full CSS.

    eg “magic” phantom scripts

    given phantom is webkit/chromium/blink-based, this is unlikely to also extract CSS that is used for non-chromium-based browsers, no? and as this is based on a specific version of webkit/chromium/blink it would work on selectors it *knows”, disregarding older or newer constructs that might be needed for older/ newer browsers?

    this looks like a pandora’s box to me, but if ever you (know someone who) is able to create this I’ll certainly have a good look at possible integrations! 🙂

    Excellent! thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Optionally Processing CSS through a second processor? (unused-css)’ is closed to new replies.