In hook_advagg_modify_css_pre_render_alter(), stylesheets are iterated over and the boolean $critical_css is set to determine whether any inline critical CSS has been added. If not, some functions are run through to determine whether deferring should be enabled or not. However, this code does not check for the newly added option which is meant to disable deferring of stylesheets if no critical CSS file is found.

Comments

kevineinarsson created an issue. See original summary.

kevineinarsson’s picture

Attached patch attempts to fix this by specifically checking if deferring has been set to use this option, and if so, return early.

I'm unsure if this should be part of advagg_mod_css_defer_page(), but from what I can tell this function is meant to check if deferring is enabled or not, rather than the actual method being used. If this is not the case it should probably be done there.

kevineinarsson’s picture

Status: Active » Needs review
mikeytown2’s picture

Thanks for the patch! How does this look to you? Put the check for the foreach loop.

kevineinarsson’s picture

That makes sense, but there still needs to be a return if no file is found within this conditional. As otherwise the page still matches through advagg_mod_match_path(), unless you have the variable advagg_mod_css_defer_pages set by having previously used the whitelist option.

mikeytown2’s picture

Status: Needs review » Fixed

Thanks for your work on this! It's been committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.