Creating Small Components in a Theme and Loading CSS for Each Part

[ad_1]

I'm working on small component parts for a WordPress theme. I've placed several small template parts under template-parts/components/. Correspondingly, I've placed the CSS for each part under /assets/css/template-parts/components/.

First, is it common practice in WordPress theme development to create multiple small components? (I'm approaching this with a mindset similar to React components.) Additionally, in this scenario, what would be the best practice for loading the CSS for each part as it's loaded?

[ad_2]
1 Comment
  1. Breaking your theme into small components is a good approach, and to load CSS for each part

 

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