Support » Plugin: Autoptimize criticalcss.com power-up » Best Practice for Rules by Type

  • Hi

    I have several ‘types’ of content styles on my webiste. Specifically for ‘Posts’ I have some that are created with Thrive Architect, some that are built up from self-coded HTML code which are pretty big but done in the classic editor to minimize Thrive Bloat, and some normal type blog posts which are, more or less, simply text and images.

    All of these ‘Posts’ are created in the usual Add New Post way.

    In the Autoptimize Critical CSS tab I see the rules created for is_single, is_page, is_blog_page etc. All of the posts are listed under is_single. So I have Critical CSS creating one rule to cover all my three post ‘styles’.

    I am aware of the ‘path’ option to create rules but afraid if creating rules for hundreds of pages and posts, then the size of the storage is going to become a problem. This is an assumption and perhaps you could comment on what problems I might face down the line ticking this option.

    I wondered whether it would be a good idea to create a custom post type. Maybe 1 for Thrive Built Pages and another for Self-Coded pages without all the Thrive CSS which is not even used on those pages. Do you think this is a good idea and would bring benefits?

    I assume a Custom Post Type would still be ‘is_single’ so if you think it is worthwhile, how do I ensure that a seperate rule is generated for that type automatically or do I need to do it manually if the critical.css service cannot handle it automatically.

    Could you advise best practice here? Thank you so much in advance.

    • This topic was modified 3 years, 8 months ago by slipperx.
    • This topic was modified 3 years, 8 months ago by slipperx.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    The best option would indeed be to create a CPT, which should take precedence over is_single for the creation of AUTO rules.

    hope this helps,
    frank

    Thread Starter slipperx

    (@slipperx)

    Hi Frank

    I did create a custom post type and created a new post in it. The post appeared in the job queue and was processed since it was not still there this morning. However no new rule was created so I still have the basic default post type rules only – is_single, is_archive, is_page etc. There is no new rule for the custom post type.

    Is there something else I need to do to register it somehow so that Critical CSS Power Up sees it as a new type to create a new rule for?

    Also, could you comment on the effect of enabling the ‘PATH’ option which I think forces new rules for each separate page – it’s another solution and easier to implement than creating custom post types but maybe has downsides speed-wise.

    – where do all these rules get stored?
    – how much space might they be expected to take up
    – is there any speed effect in fetching those rules for any given page is there are hundreds of pages – I assume they are in a database and need to be found each time a page loads but that is just my assumption.

    There is a huge issue with Thrive, and other page builders I assume, as it puts wrappers around every single element which just bloats the page with unnecessary and unused CSS.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    -> rules get stored in an array in wp_options
    -> critical CSS gets stored on the filesystem (wp-content/uploads/ao_ccss)
    -> approx. 500 bytes in the array in the db (guesstimate) and 5kb on filesystem per fule
    -> barely; the rules array is always fetched even if only one rule, theoretically you could have a (small) slowdown when thousands of rules are active

    hope this clarifies,
    frank

    Thread Starter slipperx

    (@slipperx)

    Hi Frank

    As I am not getting anywhere with the Custom Post Type solution not working, I have been persevering with the Force Path-Based Rules. Slowly the rules are getting stored at a rate of about 1-2 per day.

    My Advanced settings only allow for 3 requests per run.

    I am about 1/10 the way through pages and posts processing into rules and my cache size is already over 300k. I think I will shortly run out of space.

    I have 12 Auto Path-Based Rules and 6 generic type rules but the cache is holding 591 files.

    I am worried the cache is going to break its limit and cannot see what to try next to get this implemented. Can I suggest a modification to group a set of pages under one rule set for people who have a few different page types all sitting under the is_single moniker?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    the “cache size” and number of files as reported by Autoptimize is not linked to the critical CSS rules slipperx, have a look at Autopitmize FAQ for more info on cache size if it keeps on growing (although 300KB is nothing to worry about).

    frank

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Best Practice for Rules by Type’ is closed to new replies.