Skip to content
Tom Magnusson edited this page Apr 3, 2018 · 3 revisions

Style

We use (all languages):

  • Two spaces for indentation
  • Egyptian curly brace blocks
  • Descriptive:
    • Comments
    • Variable names
    • Function names

Example:

/// Updates the nav item to reflect which page you're on (turn it gray when you're on about_us, for example)
function updateNavItemSelected() {
  // don't want color change on these pages
  if(location != "index.html") {
    // changes color on the nav bar depending which screen you are on
    const page = document.getElementById("page");
    if(page !== null) {
      $(page.content).css({"color": "#535353"});
    }
  }
}

Naming Conventions:

  • lowerCamelCase for
    • variable names in
      • JavaScript: var modalShouldBeShown
      • PHP: $firstName
    • function names in JavaScript: function renderNavBar()
  • lower-dash-case for
    • class names in CSS: flavor-text
    • id names in HTML: meet-the-team-header
  • lower_snake_case for
    • files: meet_the_team.html, activities_fair.jpg
    • function names in PHP: function arrayFilter()

Please use relative paths when referencing any page on the server:

<script src="../js/script.js"></script>

Clone this wiki locally