Recommended File Standards for Web Development

These settings help keep files consistent and compatible, reducing problems across different editors, operating systems and web servers.

For Web Development

  • End Of Line (EOL): LF (\n) > Applies only to text files (1)
  • Encoding: UTF-8 without BOM > Applies only to text files (1)
  • Final newline: End every text file with one newline character > Applies only to text files (1)
  • Trailing whitespace: Remove spaces and tabs from the ends of lines > Applies only to text files (1)
  • Filename case: Linux is case-sensitive, consistently prefer lowercase filenames

For WordPress specifically

  • PHP-only files: Omit the closing ?>
  • File permissions: Normally 644 for files and 755 for folders

More info

Types of files

  1. Text files.php, .css, .scss, .js, .html, .json, .xml, .svg, .txt, .md, .po, .pot…
  2. Binary files.jpg, .jpeg, .png, .gif, .webp, .ico, .woff, .woff2, .mo, .pdf, .zip…

End Of Line (EOL)

  • CRLF = carriage return + line feed = \r\n = 0D 0A > Used traditionally by Windows
  • LF = line feed only = \n = 0A > Used by Linux and modern macOS > Recommended for Web Development

UTF-8 / BOM

  • UTF-8 = Standard encoding text characters into bytes > Used across Windows, Linux, macOS and the web
  • BOM = Byte Order Mark = EF BB BF > Optional invisible bytes placed at the beginning of a UTF-8 file
  • UTF-8 without BOM = UTF-8 text without EF BB BF at the beginning > Recommended for Web Development

AI Prompt

Audit all files in this folder and its subfolders without modifying anything.

Check all text files:

  • All text files: Use UTF-8 encoding without BOM.

Check PHP files:

  • All PHP files: Use LF-only line endings (no CRLF or lone CR).
  • All PHP files: End with exactly one newline.
  • All PHP files: Omit the final closing ?> tag.
  • All PHP files: Internal ?> tags in mixed PHP/HTML templates are allowed.

Check CSS/JS files:

  • All files in css/*.css and js/*.js: Use LF-only line endings (no CRLF or lone CR).

Exclude:

  • Binary files.
  • .git metadata.
  • Specific folders: fonts/ img/ languages/ polylang/ src/

Report:

  • The total number of files checked.
  • The number of text, binary, and PHP files checked.
  • Every non-compliant file and the reason it failed.
  • Any exceptions that should not be changed.
  • List your recommendations.

Contact me about: Recommended File Standards for Web Development, by:

  Email »  WhatsApp »