Site logo

Archived topic

Exclude hamburger menu from "Remove Unused CSS" WP feature

18 replies · Started by Eric on June 28, 2021

Viewing posts 16–19 of 19

Yeah best to take the issue to WP Rocket, as its their code thats doing the used/unused CSS function. Not sure how that works...

Hi everyone,

I had the same issue with my mobile hamburger menu not opening after enabling the Remove Unused CSS option in WP Rocket.

I fixed it by adding the following to the CSS safelist:

/wp-content/plugins/gp-premium/(.*).css

However, this excludes all GP Premium CSS from the "Unused CSS" feature in WP Rocket. So I was curious if anyone has been able to narrow it down to the exact class or ID that needs to be safelisted, rather than safelisting the entire GP-Premium CSS file? This is a tricky one!

Best regards,
Jesse

i've added this rule: /wp-content/themes/generatepress/assets/css/components/font-icons.min.css(.*)

I don't know if you need that bit at the end (.*). that narrows it down to 1 file. It appears that WP Rocket is losing the GeneratePress font which generates the burger menu.

I do think that it's quite important we are helped with this one as WP Rocket is used heavily in the wild. If it can be narrowed down to a class it would be even better.

If you set the Customizer > General > Icon Type to SVG, then GP won't load the font-icons.min.css. So thats one less resource to load.

I am not sure if exluding classes will fix the issue. The one common class for the hamburger would probably be: menu-toggle

You could give that a try.

This archived topic is closed to new replies.