Bug in CSS exclude Filters
-
Hi,
I was stuck for long time, since I needed to exclude a CSS file from being combined and excluded from having the query parameters removed. Looked into source code and found a bug. Please have a look yourself to check.
What I have done is adding 2 Filters (for the same CSS):
add_filter( ‘sgo_css_combine_exclude’, function ( $excludeList ) {
$excludeList[] = ‘my-file-handle’;
return $excludeList;
} );
add_filter( ‘sgo_rqs_exclude’, function ( $excludeList ) {
$excludeList[] = ‘part-of-file-name’;
return $excludeList;
} );The bug is now in Css_Combinator.php:
* Line 185 adds file name to exclusion list in form of /path/to/css, WITHOUT query params
* Line 223 would correctly removes the query strings to have an equal check, but if you have remove query params on and want to exclude a file, this method skips the removal of the query params of the file.
* Line 225, bc of skipping in remove_query_strings, line 225 checks against WHOLE path, incl. query params, which is not string equal.This leads to a condition, where the file is not combined, and not loaded anymore. But I have not looked into why this happens, only observed that css is missing.
Thanks, Alex
- You must be logged in to reply to this topic.