Wego Engineering

Docs, guidelines and compromising photos

To make changes to these pages, checkout the wego.github.io project and the GitHub Pages docs.

This is a living draft, please feel free to submit pull requests (with use cases/reasons) for improvements to what are stated here.

Some of these guide lines are simple in theory but difficult in practice. Just try because they are not being followed very thoroughly at the moment either. (troll)

Philosophy

HTML Style Guide

// Not so good
<del>$50</del>
<ins>$20</ins>

del { color: red; }

// Better
<del class="rate-original">$50</del>
<ins class="rate-discounted">$20</ins>

.rate-original { color: red; }
// partial.html.erb
<div class="room-rates">
  <span class="rates hide-for-medium-down">$100</span>
</div>

// show_rates_for_large_only.html
<%= render 'partial' %>

// show_rates_for_all_sizes.html, wait what.
<%= render 'partial' %>
// Bad...
<a class="orange-round-button">...</a>
<a class="orange round-button">...</a>

// Because what if we want blue button for static page? :(
<a class="orange but_blue_for_static round button">...</a>

// Now we're talking.
<a class="button internal loading">loading button</a>

.button {
  // .. default button styles ...
  // orange, round, blah

  &.internal {
    // style for internal linking button
    // maybe diff shade of orange
  }
  &.external {
    // style for external linking
    // make it purple maybe?
  }
  &.loading {
    // patterns for when loading...
  }
}
// Verbose
.example1 {
  @include respond-to(desktop) {
    display: none;
  }
}

.example2 {
  display: none;
  @include respond-to(desktop) {
    display: block;
  }
}

.example3 {
  display: none;
  @include respond-to(tablet) {
    display: block;
  }
  @include respond-to(desktop) {
    display: none;
  }
}

// Precise
<div class="example1 hide-for-large">...</div>
<div class="example2 show-for-large">...</div>
<div class="example3 hide-for-small hide-for-large">...</div>
<span>
  <i class="icon-search show-for-small"></i>
</span>
<div id="help" class="help">halp!</div>

SASS Style Guide

// nope
.test {
  display: none;
}

.test {
  display: block;
}

// yes
.test {
  display: none;
}

span.test {
  display: block;
}
// Not so good
.listings .stars {}
// Good
.stars.stars-listings {}

// Not so good
.hotels .card
// Good
.card.card-hotels

.card { &.card-hotel {} &.card-airfare {} }

.stars {} ```

.breadcrumbs {
  @include something;
  @include else;

  text-align: right;
}
.help {
  @include clearfix;
  ...
}
@include section(
  $section-type: accordion,
  $title-color: $primary-color
);
// Good
padding: emCalc(10, 1);
padding: emCalc(10);

// Not so good
padding: emCalc(10px) emCalc(11px);
.subheader {
  @include respond-to(mobile) {
    font-size: emCalc(16, 10);
    border-bottom: 1px solid;
  }
}

External Resources

Must-Reads
Optional reads/visits