Skip Navigation

[Resolved] Why does Toolset View load 13 extra CSS and JS files in the frontend?

This thread is resolved. Here is a description of the problem and solution.

Problem:
Even on pages that don't use it, Views loads many CSS and JS assets that are not required.

Solution:
This is a known issue. For technical reasons Views loads assets that might be required on the page, and there are no options or filters to modify that.

A future version of Views will add more granular control about what is loaded where.

This support ticket is created 6 years, 3 months ago. 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Matthias 6 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#1084535
wp-without-toolset-views.png
wp-with-toolset-views.png

Hello,

after activating the Views plugin, WordPress loads 13 extra CSS and JS files in the frontend, even when I'm not logged in. Theses files are:

/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css
/wp-includes/js/mediaelement/wp-mediaelement.min.css
/wp-content/plugins/wp-views/embedded/res/css/wpv-pagination.css
/wp-includes/js/mediaelement/mediaelement-and-player.min.js
/wp-includes/js/mediaelement/mediaelement-migrate.min.js
/wp-includes/js/jquery/ui/core.min.js
/wp-includes/js/jquery/ui/datepicker.min.js
/wp-includes/js/mediaelement/wp-mediaelement.min.js
/wp-includes/js/underscore.min.js
/wp-includes/js/wp-util.min.js
/wp-includes/js/backbone.min.js
/wp-includes/js/mediaelement/wp-playlist.min.js
/wp-content/plugins/wp-views/embedded/res/js/wpv-pagination-embedded.js

This is a huge performance issue for me and I'd like to understand why this is necessary. Why do I need all these? How can I prevent loading these files if I don't need them?

In the example in my screenshots I didn't even create any custom post type or any view. I just activated the plugin and loaded a default post.

Cheers,
Matthias

#1084605

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Matthias

This is a known issue that we intend to improve. It is not slated for this development cycle, but I will try and get it included in the next.

Briefly, the issue arises because how Views can be inserted via shortcode pretty much anywhere on a page, including in a footer widget.

So as the header of a page is being assembled, we don't yet know whether it actually contains a View or not, and so Views assumes that it might be and includes all of the assets that a View may require.

We have an internal ticket to revisit this and make some changes to better target where assets are required, or to—at least—give developers more control themselves over what to include where.

I have shared some tips previously on how to manually dequeue scripts if you can't wait for the update: https://toolset.com/forums/topic/dequeue-unwanted-scripts-and-embedded-snippets/

#1085522

Hi Nigel,

thank you. As I don't need the pagination it's a good solution for me to dequeue these scripts and styles.

Maybe it would be handy to have an option in the toolset settings where you can switch pagination on/off which also triggers to load or not load theses scripts and styles.

Thanks again for your help!

Cheers,
Matthias