Skip to content

gabrielkoerich/guidelines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Guidelines

General

  • Contributions must follow the GitHub Flow with slight modifications. Create a new branch and pull request it to develop. Never directly to master.
  • Use the present tense ("Add feature" not "Added feature") and the imperative mood ("Move class to..." not "Moves class to...") on commits and pull requests.
  • Pull requests must be reviewed before merged.
  • All classes, functions and variables names must be in english. Avoid abbreviations.
  • Use 2 spaces indentation for HTML, CSS and Javascript. 4 spaces for PHP. You should install the EditorConfig Plugin to configure automatically your Sublime Text.

PHP Coding Style

We must follow the PSR-2 coding standard and the PSR-4 autoloading standard.

You also should read the PHP The Right Way.

PHPDoc

Below is an example of a valid documentation block. Note that the @param attribute is followed by two spaces, the argument type, two more spaces, and finally the variable name:

/**
 * Register a binding with the container.
 *
 * @param  string|array  $abstract
 * @param  \Closure|string|null  $concrete
 * @param  bool  $shared
 * @return void
 */
public function bind($abstract, $concrete = null, $shared = false)
{
    //
}

HTML Coding Style

  • Keep white space to a minimum.

  • Use 2 spaces for indentation

  • Do not use XHTML closing syntax <br /> - just use standard syntax <br> instead

  • Lowercase all elements and attributes (it just looks so much neater).

  • Indent main 'sections' - for example:

      <html>
        <head>
          <meta>
        </head>
        <body>
          Content
        </body>
      </html>
  • Keep <head> section in the following order…

    1. <title> element
    2. <meta> elements
    3. Any required scripts (e.g. Modernizr or the HTML5 Shiv, scripts that must be loaded before page render)
    4. Style sheets
  • Keep HTML structure simple and not too deeply nested.

  • Use styles up top in the <head> and scripts at the bottom before </body>.

  • Compress your styles and scripts.

  • Avoid making

  • Use HTML5 form controls when applicable to trigger the right keyboard on mobile (url, email…)

Example

Here follows is a basic boilerplate of an HTML page…

  <!doctype html>
  <html dir="ltr" lang="pt-br">
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1">
      <title></title>
      <link rel="author" href="/humans.txt" type="text/plain">
      <link rel="stylesheet" href="styles.min.css">
    </head>
    <body>
      <!-- ... -->
      <script type="text/javascript" src="scripts.min.js"></script>
    </body>
  </html>

CSS Coding Style

Just follow the Airbnb CSS Style Guide.

Javascript Coding Style

Just follow the Airbnb Javascript Style Guide.

Links

Sublime Text Plugins

Sublime Text Color Schemes / Themes

About

My PHP, HTML, CSS and Javascript guidelines.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published