Is it possible to restrict the loading of L&L's CSS and JS files in the WordPress backend exclusively to L&L pages?

Hi L&L team,

I recently had a problem with the loading times of some admin pages caused by another plugin, and while troubleshooting I happened to discover that L&L’s CSS and JS files are loading on some pages where they are not actually needed. Since I don’t develop plugins myself, it’s difficult for me to assess whether this would be easy to implement or even make sense, but since the files are about 0.5 MB in total, I think it would be nice if the loading could be restricted to keep the backend clean and lean.

The files in question are the following:

JS files:

  • scsslint.min.js
  • jsonlint.min.js
  • jshint.min.js
  • htmlhint.min.js
  • csslint.min.js
  • codemirror.min.js

CSS files:

  • codemirror-theme-light.min.css
  • codemirror.min.css

These files are loaded on the following wp-admin pages:

  • on all taxonomy and custom taxonomy pages (list view, edit view)
  • on all attachment pages (list view, grid view, edit attachment view)
  • on all edit post pages (core post types and custom post types; no matter if a post type has a single page or not)
  • within WP Customizer
  • on edit menu pages (/wp-admin/nav-menus.php)
  • on most ACF pages (ACF option pages, edit ACF field group, edit ACF CPT, edit ACF custom taxonomy, ACF tools)
  • on edit user profile pages
  • within Elementor Editor, regardless of whether a tangible template widget is present or not
1 Like

Hi Stefan,

I am by no means able to speak on behalf of the Tangible developers or team, but my take on this is that it’s a ‘necessary evil’, since the L&L editor can exist in so many places. (All the listed files are related to the editor itself. It uses Codemirror, and the hint/lint files are the ones checking the validity of the code, etc.)

That said, you could possibly unload these files, in places you don’t need them, using a plugin like Autoptimize.

1 Like

Hi Mikkel,

thanks for pointing that out, there may be use cases I hadn’t thought of because I’m so used to my own working routine. Still, I can’t really imagine how the L&L editor could be used in some places like the media library or on ACF settings pages etc.

Manually unloading should be possible with autoptimize or just wp_dequeue_script / wp_deregister_script, yes, but I think it would be better if this is handled by the plugin itself, in case this is some kind of oversight. But as I said, not being a plugin developer, I’m not sure how this is normally handled.