arnowelzel / lightbox-photoswipe

Integration of PhotoSwipe to WordPress
https://arnowelzel.de/wp/en/projects/wordpress/lightbox-with-photoswipe
GNU General Public License v2.0
27 stars 7 forks source link

Add option to enable only of needed #72

Open arnowelzel opened 3 years ago

arnowelzel commented 3 years ago

Also see https://wordpress.org/support/topic/include-lightbox-js-only-when-gallery-is-used-on-that-page

Detecting the need of queuing scripts and styles is not possible since this requires access to the final post output which is not available before the scripts and styles got queued already.

However before queuing scripts and styles the raw post content could be checked if there is a Wordpress gallery shortcode or a Gutenberg gallery block used. This could be used to offer an option like "enable only if post or page contains a Wordpress or Gutenberg gallery".

mtoensing commented 3 years ago

That would be a wonderful feature.

maxime-pasquier commented 2 years ago

It will be great yeah! Especially for the CSS in the head (the JS is in the footer so I don't really care ^^) The lower we load, the faster we get!