Auto-disable assets where no lightboxable images
Hi. Loading too much unnecessary JS is always a concern. Human-curated meta box configuration is not sustainable.
I'm thinking we could scan via the_content filter, or possibly output buffer the whole page output, for a heuristic on whether to load our JS/CSS assets at all.
Your thoughts?
This is an interesting idea. I'm not sure that scanning the_content would be robust enough as many pages could be built using meta data, widgets, etc. I'm open to reviewing a PR for this, if you have something specific in mind.
I'm not sure that scanning the_content would be robust enough as many pages could be built using meta data, widgets, etc.
Full page output buffering might indeed be the only way. I know some plugins are doing such ob for their purposes, so it's not unheard of.