File Name Conventions for Web Developers
Trained web developers should have good habits. All files you create should follow simple naming convention:
- only alphabetic characters
- no capital letters
- no spaces
- no special characters, except the underscore
_character - always use filename extensions:
.htmlfor HTML markup files.cssfor CSS style sheet files.jsfor Javascript files.giffor GIF image files.jpgfor JPEG image files.pngfor PNG image files.phpfor PHP files.pyfor Python files.txtfor text files.csvfor text files with comma-separated values.zipfor compressed zip files- etc…
Principled stand on the minus sign
The current generation of highly-skilled web developers often use the - character in filenames and some very-experienced Search Engine Optimization (SEO) consultants even pronounce that using dashes (-) instead of underscores (_) in file names leads to better placement on the search engine results page (SERP) leading to more visitors to websites that use them. We will never condone this practice.
Other applications of these conventions
These same conventions generally apply to the following:
- variable names
- function names
- database names
- database table or collection names
… except that:
- you don’t need to put filename extensions on things that aren’t files
- there are some programming languages and technologies that have a strict convention of using lowerCamelCase, UpperCamelCase, or other naming scheme - in those cases, follow the conventions of the technology you are using.