File and Folder Naming Conventions
Overview
When working on the web, there are many things that affect the operation of the files—the browser, the protocol(s), the operating system, the language(s), etc. While many of these are out of your control, there are steps you can take to help keep things consistent and manageable through standard file and folder naming conventions.
"When you're building a website, you need to assemble these files into a sensible structure on your local computer, make sure they can talk to one another, and get all your content looking right before you eventually upload them to a server." - MDN
Prepare
- The file and folder naming conventions will be considered 'best-practice' rules for this course. These rules
should be applied to all files and folders created in your course work.
Note that most organizations have defined a standard convention for naming files and folders in addition to other workflows. These conventions may vary as each organization will have their own file management guidelines and 'best' practices.
- Review: 📄Dealing With Files - MDN
Naming Conventions
You will be expected to follow these naming conventions throughout the course.
- Use all
lowercase
syntax, e.g.,
products.html
Platforms and systems handle case sensitivity differently. Case sensitivity is an important concept to understand when managing files and folders. - Do
NOT
use
spaces
in names. Use dashes instead, e.g.,
design-document.html
Spaces are interpreted poorly by user agents. Do not use them. The Hypertext Transfer Protocol (HTTP) ignores spaces, except in file names. In file names, it replaces a space with a symbol—"%20
." This makes URL's look confusing and can also lend itself to confusion in the mind of site visitors. So avoid using spaces. Instead, if you have to create a visual space, use hyphens/dashes. - Do
NOT
use
special characters, e.g.,
<,>, \, /, #, ?, !
Special characters often mean specific things to computers, so just avoid using them completely in the naming of files and folders. - Use as short and as meaningful (semantic) of names as possible, e.g.,
winter-scene-sm.png
vs.image13-v123523brokenbranchlifeimagery w200x200.png
Short, meaningful names save you, other developers, and site visitors from having to remember long complicated names for files and folders. When meaningful, they also help predict the purpose or nature of the file or folder contents when working with those files or folders. - In this class, the
standard folder names
for our sites/sub-folders are:
- styles - Folders with this name contain our CSS files.
- images - Folders with this name contain our images.
- scripts - Folders with this name contain our JavaScript files.