Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

JS & CSS included on all page loads, whether needed or not #161

Open
wadetregaskis opened this issue Jan 1, 2024 · 4 comments
Open

JS & CSS included on all page loads, whether needed or not #161

wadetregaskis opened this issue Jan 1, 2024 · 4 comments

Comments

@wadetregaskis
Copy link

e.g. on feed pages, where the ToC is never rendered.

Specifically, front.min.js & screen.min.css.

It is somewhat possible to manually block these using plug-ins like Asset CleanUp, but it'd be nice if that weren't necessary (TOC+ is otherwise such a nice, svelte plug-in - it's a shame to have to install a behemoth like Asset CleanUp in order to use it).

@zedzedzed
Copy link
Owner

Like most others, this plugin uses wp_enqueue_scripts to load js and css files at the appropriate viewports, that is usually in browser, for a normal web page. This shouldn't be outputting to feeds. I can confirm from testing that it is operating correctly for me (no js/css files in feeds).

@wadetregaskis
Copy link
Author

To be clear, by 'feed pages' I mean things like the home page (assuming it's set to list recent posts), search results, etc. When only excerpts are shown, the ToC cannot be presented because WordPress doesn't allow anything but plain text in excerpts (well, other than the feature image, if set).

I do not mean the RSS feeds.

zedzedzed added a commit that referenced this issue Feb 21, 2024
@zedzedzed
Copy link
Owner

Have attempted to prevent the CSS and JS files from being added. At the moment, it respects your TOC settings so it won't output to the homepage if you've disabled that or to a disabled post type for auto insertion. A limitation is that it will still output to an eligible page if there are not enough headings.

@dhananjaygbhardwaj
Copy link

@zedzedzed The front.min.js file is being inserted regardless of deselection of the options in the plugin settings. Even wp_dequeue_script('toc-front'); is not working.

I had to roll back to version 2311 to fix this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants