• Reproduce this Issue:

    create two blank css file and enqueue.

    abc-debloat-style.css

    
    .preserved-case-auto{
        color:red;
    }
    

    cde-debloat-style.css

    
    .preserved-case-auto{
        color:red;
    }
    
    body{}
    

    so if you look at source, you will see abc-debloat-style.css not removed from source, but cde-debloat-style.css procceds and removed unused css( preserved-case-auto ) selector & preserved body selector fine.

    Please fix this issue, thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author asadkn

    (@asadkn)

    More details are required. I don’t understand the issue from the provided details. Additionally:

    – How are you enqueueing these.
    – The exact Debloat settings you’re using.
    – Is any HTML tag using the .preserved-case-auto class

    Thread Starter Nabil Sikder

    (@mdnabilsikder)

    1. simple, wordpress enqueue method https://prnt.sc/26in5le
    2. https://prnt.sc/26in6d3
    3. no, no tag using that selector.

    This is the issue here, if a css file not have any used selector, it’s not removed from source, this css file should be removed from source.

    Plugin Author asadkn

    (@asadkn)

    Got it. However, it’s leaving body{} in there because body tag exists in HTML, obviously. It’s correctly stripping the other classes.

    A stylesheet should never use an empty body selector to begin with, so it’s a very rare case and a check against it would be un-necessarily expensive. Will see in future if this comes up again.

    Thread Starter Nabil Sikder

    (@mdnabilsikder)

    I understand, but looks like you didn’t got my point yet.

    I tried to explain that,

    – if any stylesheet not have used selector, that stylesheet should be remove completely from source.
    – if any stylesheet have used selector, that stylesheet should be preserved in source.

    but here if no used selector found in stylesheet that stylesheet just leaving orginal source as it is, and this thing making this feature non-usable.

    I don’t have issue with that empty selector preserved. I hope you got my point.

    Thanks

    Plugin Author asadkn

    (@asadkn)

    Ah ok, so you’re referring to the file case-debloat-style.css. There can several reasons for this.

    – Error in the CSS file / malformed / non-validated CSS that cannot be parsed properly.

    – The file cannot be read properly with incorrect permissions.

    Note: The file may have been cached when it had an error. In this case, debloat cache has to be cleared.

    Can you share the current content of both these CSS files.

    Thread Starter Nabil Sikder

    (@mdnabilsikder)

    Yes, I am referring to that.

    no, both cases not there, as i checked.

    both files have same thing as like this issue reported.

    .preserved-case-auto{
        color:red;
    }
    .preserved-case-auto{
        color:red;
    }
    
    body{}

    it’s a reproducible issue, as i checked with multiple cases. you will see this issue exactly if you try with my use case

    Thread Starter Nabil Sikder

    (@mdnabilsikder)

    Hello Dev,

    A Quicklook here, i checked why it’s happening here,

    if ($sanitized_css) true or more simple word selector found then it will process that css file, otherwise it will return original css url. so i think you should add else condition here.

    if $sanitized_css not found, do two check.

    1. If Delay CSS on add Delay CSS URL
    2. If Delay CSS off comment that stylesheet or blank whatever you feel, but comment will be usefull in case of debugging.

    Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Unused stylesheet not removed properly’ is closed to new replies.