Sauter la navigation

[Résolu] Avoiding CSS import in terms of speed

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
The following external stylesheets were included in .../wp-content/cache/min/1/9f758f96fdb5c4c83c9909230aa32fea.css using @import.

.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-admin-styles.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-buttons.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-colors.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-styles-helper.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css

The users didn't want these styles to be loaded.

Solution:

Please add this code in your theme’s or child theme’s functions.php file to dequeue (remove) it on the frontend:

add_action('wp_enqueue_scripts', function() {
  wp_dequeue_style('toolset-notifications');
  wp_dequeue_style('onthego-buttons');
  wp_dequeue_style('onthegosystems-icons');
  wp_dequeue_style('onthego-colors');
  wp_dequeue_style('onthego-styles-helper');
  wp_dequeue_style('onthego-admin-styles');
   
}, 20);

Relevant Documentation:
https://codex.wordpress.org/Function_Reference/wp_dequeue_style
http://inspirationalpixels.com/tutorials/remove-plugin-scripts-wordpress

This support ticket is created Il y a 6 années et 8 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Ce sujet contient 16 réponses, a 2 voix.

Dernière mise à jour par amarinos Il y a 6 années et 8 mois.

Assisté par: Shane.

Auteur
Publications
#632386

Hello,

we just noticed on GTmetrix this: lien caché

The following external stylesheets were included in .../wp-content/cache/min/1/9f758f96fdb5c4c83c9909230aa32fea.css using @import.

.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-admin-styles.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-buttons.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-colors.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthego-styles/onthego-styles-helper.css
.../wp-content/plugins/types/vendor/toolset/onthego-resources/onthegosystems-icons/css/onthegosystems-icons.css

Can you explain this to us and how to avoid this? Any tips?

I also wonder why they are loading on the fronpage ...

Thanks for helping,
am.

#633007

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

Thank you for contacting our support forum.

Unfortunately there isn't a way to avoid this since this is something that is internal to our plugins.

What I can recommend that you try is to install the WP Super Cache plugin and see if the CSS can be cached.

Thanks,
Shane

#633057

Internal to types & views?

But I do not understand why css is loaded at the front page?
We use plugin features on a sub-page , to load it here would be okay ... hmh?

We do not use WP Super Cache , we use WP Rocket and normally all other CSS is cached.

What about this here (found it by luck and google):
https://toolset.com/forums/topic/optimize-front-end-css/

If we use this code to dequeue it on the frontend can you confirm that the functionality of the plugin is not limited?

Best,
am.

#639381

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

I suspect that this will just cause some of the icons we use on the backend on our plugins to not show up.

Thanks,
Shane

#639597

Hello Shane,

So save to use? Or not? It would be nice if you can assist here more ...
One side note: Can you pls check our website (thedolphinsvoice.org)? you'll see 3 jQuery errors related to Toolset ... Can you help to avoid or fix them too?

Thanks in advance,
am.

#640108

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

It should be safe, just that you will not be seeing some of the usual icons being displayed as normal.

Thanks,
Shane

#641057

Hello Shane,

okay, so I will try it and see what maybe will not work ... Did you check the jQuery errors from my above mention?

#643266

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

Yes I saw these errors but it may be due to plugin conflicts our outdated versions of our plugins.

The only way to check this is by disabling all the non-toolset plugins and checking again or updating the plugins.

Please try this and let me know the results.

Thanks,
Shane

#643378

Hello,

can you pls be more specific in your answers? Do you mean the Toolset plugin version are outdated?

I use this versions:
Toolset Advanced Export active 1.0 No Update
Toolset Layouts active 2.3-b1 No Update
Toolset Types active 3.0-b1 No Update
Toolset Views active 2.6-b4 No Update

... any updates avail. ???

Disabled all non-toolset plugins errors still exists ...

Best wishes,
am.

#643666

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

I must apologize as i wasn't aware of the plugins on your site since the debug information wasn't provided.

I see that you are using the beta plugins on a live site, which is not recommended as issues will arise since its meant for customers testing and trying out new features. Sometimes these features or functionality don't work 100% but it's strictly for testing purposes.

Could you install the latest stable version of our plugins as from what I see could be from the beta plugins. An alternate option is that you can provide me with duplicator package from your website and I perform these tests for you.

To provide me with a duplicator package, please have a look at the link below.

https://toolset.com/faq/provide-supporters-copy-site/

Thanks,
Shane

#644614

Hello,

yes, you are right about betas ... but as far as I remember the jQuery things are also present in or with the latest stable versions ... anyway, I deleted now the betas and reinstalled the stable ones ... and as I write this I also test the behaviour ...

What can I say: Same same as I expected ... 🙁
Okay so you see this jQery errors are only related to Toolset or do you see that they are shown because of a combination like ***Theme + Toolset + Plugins*** ???

Can you open up a private option here so I can point you to the staging page , here you can see the errors now too ...

Best wishes & many thanks in advance for helping,
am.

#645112

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

The private fields have been enabled, also I would like to take a duplicator package of this website if possible should I need to escalate to our 2nd tier team.

Thanks,
Shane

#650067

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Screen Shot 2018-04-11 at 2.33.01 PM.png

Hi Amarinos,

So I took the duplicator plugin and created the duplicator package but when i restored the backup i'm not getting any errors in the console at all. See Screenshot

Could you provide the debug information on this site so that I can take a look at it ?
https://toolset.com/faq/provide-debug-information-faster-support/

Thanks,
Shane

#651634

Hello Shane,

okay, you see this on Chrome and here you do not get any error outputs? This is really strange.

Maybe hosting related?
Are you on the front end visiting the page?
All plugins enabled?

What I see: lien caché

Best,
am.

#652800

Shane
Supporter

Les langues: Anglais (English )

Fuseau horaire: America/Jamaica (GMT-05:00)

Hi Amarinos,

Yes this is with all plugins enabled. All I did is to import the site and view it.

So I suspect that the issue as you say is hosting related .

Thanks,
Shane