The naming of folders and files is a small detail that can make all the difference when maintaining a website.
Here are a few recommendations for naming components, folders and files, including HTML, image, scss, twig and hbs files
- Use natural language to name folders and files. Natural language is everyday, conversational, and usually descriptive language. If a folder or file name can easily be read and understood, both by your co-workers and your parents, then it’s probably natural language.
- Short, but meaningful. If it is a composite name try to abbreviate the second, third name. ie: single-msg.scss
- Typeset all file and folder names in lowercase.
- Don't use ‘special characters’ in folder and file names.
Follow recommendation (2.) Good examples are:
article
landing_page
Don't use plurals for content type naming.
field_contenttype_field
Examples:
field_partner_title
field_partner_image
field_partner_bg_image
Follow recommendation (2.) and check Components dictionary
field_component_field
, e.g.
single-msg
single-msg-title
Use devel
suggestion, for example
ds-reset--paragraph-cr-cards.html.twig
Use the name of the component, i.e.
single-message.scss
Use the name of the component, i.e.
single-message.hbs
Use the name of the component, i.e.
single-message.scss