Organising modules, their components, and naming files
At this point, I think it will be useful to consider a more detailed example module structure. It's similar to the structure in which I'm used to employing ECSS. It's a little more involved than our prior examples and gives another subtly different variation on how files could be organised and selectors named. As ever, from our CSS point of view our aim is isolation, consistency and solid developer ergonomics. Let's take a look.
Suppose we have a module. Its job is to load the sidebar area of our site. The directory structure might initially look like this:
SidebarModule/ => everything SidebarModule related lives in here /assets => any assets (images etc) for the module /css => all CSS files /min => minified CSS/JS files /components => all component logic for the module in here css-namespaces.json => a file to define all namespaces SidebarModule.js => logic for the module config...