What is the Best Practice for Loading CSS for Each Template Part?

When loading template parts under the template-parts/ directory, what is the best practice for loading CSS for each part? Should I include the CSS loading directly within each template file? That way, the CSS would be loaded automatically whenever the template is loaded. Is this the recommended approach?

3 Comments
  1. We looked into this at my agency. In almost all cases it is more performant to compile your block CSS in with the main theme CSS so you have a single server call for all of it, instead of multiple separate calls.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer