To be clear, I'm not looking for opinions, but rather facts based on the actual use of different types of files in different types of files.
When researching, before asking these questions, I saw a lot of messages saying that the correct folder structure for the web application. For example, I will see a list of someone where the following should go: css, js, html, images, php. But I have not seen anyone go into much of what should look like a static directory structure.
I have many images in the form of static/images/mustang_2017_front.jpg
, for example, using Ford cars. Is it better to keep them in this flat file format or use a hierarchical folder structure such as static/images/mustang/2017/front.jpg
. All images are of the same type for each car (for example, front, side, rear, top). Also, although I am asking about images, I think that conventions of conventions apply to static files in general.
Option 1 - Flat
static/images/mustang_2017_front.jpg
static/images/mustang_2017_side.jpg
static/images/mustang_2017_rear.jpg
static/images/fusion_2017_front.jpg
static/images/fusion_2017_side.jpg
static/images/fusion_2017_rear.jpg
Option 2 - hierarchical
static/images/mustang/2017/front.jpg
static/images/mustang/2017/side.jpg
static/images/mustang/2017/rear.jpg
static/images/fusion/2017/front.jpg
static/images/fusion/2017/side.jpg
static/images/fusion/2017/rear.jpg
Here are some of the benefits that I can come up with for each approach, but they are from a human point of view. Is there one option that is easier to work with in code? . It is important? I just don't want to tune in to something that doesn't scale in the future.
Option 1 - Flat Benefits
- all files have all the information in the name
Option 2 - Hierarchical Benefits
- from a human point of view, itβs easier to manually navigate and find what you are looking for using a hierarchical folder system instead of having a large number of files in the same folder.
To be clear, I'm not looking for opinions, but rather facts based on the actual use of different types of files in different types of files.
Patrick
source share