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

Optimize CSS and frontend scripts #67

Closed arnowelzel closed 3 years ago

arnowelzel commented 3 years ago

Also see https://wordpress.org/support/topic/minimised-css-files

The frontend can be optimized in two ways:

  1. Minimize CSS as well and not only JavaScript
  2. Queue scripts to be output at the footer and not the header - also see https://developer.wordpress.org/reference/functions/wp_enqueue_script/, parameter $in_footer
GermanKiwi commented 3 years ago

Thanks for considering this! :)

arnowelzel commented 3 years ago

Closed with da518ef7372dea7a5ba2ae5c56bef6d5ac896f91

black-eye commented 3 years ago

Hi @arnowelzel, please checkout my devel page https://jazykovka.twp.cz/ - even with LBWPS 3.1.4, there are still 2 CSS and 3 JS files + 1 inline JS in the code.

The reason might be the multisite install. On my other test web, which is a normal single-site, there is only 1 CSS and 1 JS as it should be.

Thanks

arnowelzel commented 3 years ago

No, multisite is no problem. See: https://arnowelzel.de - this is also a multisite setup and you can see, that there is only one CSS and one JS for Photoswipe.

It seems, you have SCRIPT_DEBUG configured on your site. Also see https://wordpress.org/support/article/debugging-in-wordpress/ about this. In this case, this result is the expected behaviour - because when this setting is enabled in the WordPress configuration, my plugin will not use the optimized files but the original version for debugging purposes.

So check your WordPress configuration if you have forgotten to remove define('SCRIPT_DEBUG', true); (or similar) in wp_config.php. This is only intended for development purposes and should not be set on production sites.

black-eye commented 3 years ago

Oh, you are right! As I wrote earlier, it is the dev site, so all the debugging is turned on there (on purpose). I've just missed the info about this behaviour. I'll bear it in mind from now on. Thanks.