• Resolved moongear

    (@moongear)


    I have noticed that the generated css files (e.g. /wp-content/litespeed/cssjs/fc01c.css) are not unique for each page. I have both minify and combine set and would expect each page to have its own file.

    This is a problem because I created a local uncss node app and am coming in after the css files are generated (via a cron) and removing the unused css for each of the generated files. When unused css is removed for one page, the inclusion of that same css file on another page results in broken styles due to them having been removed when compared to whatever happened to be the first page tested.

    I have overcome this by creating a custom css file (on the fly), named for the page being loaded and with rules that are unique (e.g. random ::after content on an insignificant element with a height of 0) then enqueueing it.

    While this does force the creation of a minified and combined css for each page, this really isn’t practical and likely isn’t reliable. Is there a setting or other inherit method within the plugin that will achieve this?

Viewing 4 replies - 16 through 19 (of 19 total)
  • Plugin Support Hai Zheng?

    (@hailite)

    The feature is in dev now.

    How did you handle the relative path for fonts and images?

    e.g. The src file is in wp-content/themes/storefront/assets/css/woocommerce/woocommerce.css.
    The generated file wp-content/litespeed/cssjs/asdfasdf.css.
    The content result has src: url("../../../../../plugins/woocommerce/assets/fonts/star.eot");.

    Thread Starter moongear

    (@moongear)

    I have not crossed that bridge, yet.

    @hailite

    I just wanted to add in our support for this feature, it is the one thing holding our sites back from getting higher that 60’s on mobile (unused CSS and JS). The Amp for WP plugin seems to have implemented something similar for CSS tree shaking and has a few functions for overcoming the relative path issues above. Might be worth looking into. class-amp-tree-style-sanitizer.php

    • This reply was modified 4 years, 4 months ago by pimg.
    Plugin Support Hai Zheng?

    (@hailite)

    Good to know. What I am trying to make is on NodeJS side. So that won’t help much.

    Thanks anyways.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Non unique minified/combined css for each page’ is closed to new replies.