Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Performance: only load concatenated CSS when needed.
See #1258 We currently enqueue a `jetpack.css` concatenated CSS file as soon as your site is connected to WordPress.com. That jetpack.css file is built off a list of stylesheets from individual modules that are not enqueued when the concatenated file is enqueued. In this commit, we add a new condition: for the file to be enqueued, there has to be at least 2 modules that need it. This will avoid loading the file when it wouldn't even be needed at all. This requires a change in the implementation: we now check for active modules before we dequeue individual assets / enqueue jetpack.css. This is an additional call to get an option (( new Modules() )->get_active()). This also means that the new $modules_with_concatenated_css variable will need to be kept updated. Note that this is only a partial improvement. We still need to address the larger questions around the implementation in today's world, as discussed here: #1258 (comment)
- Loading branch information