Crispin & Mulberry Styleguide

Conventions

The following points are guidelines, not rules. Feel free to break them when it makes sense and helps maintainability.

Further Reading:

You have read the conventions below, but want to learn more best practices? Check out this list of articles, A Scalable CSS Reading List. Some of the articles may be conflicting, but they should get you further in the same mindset of this project.

Accessibility

The site is fully keyboard navigable and tested with the ChromeVox screen reader.

Guidelines when coding

JavaScript

Synax example

function findMostRedColor(colors) {
    colors = (colors || []);

    var currentMostRedColor = null;
    for(var i = 0; i < colors.length; i++) {
        var color = colors[i];

        if(!currentMostRedColor || color.r > currentMostRedColor.r) {
            currentMostRedColor = color;
        }
    }

    return currentMostRedColor;
}

CSS/Sass

CSS Formatting

Other

CSS Property Order

The grouping of declarations is more important than the order of declarations within a group.

.selector
{
    position: relative;
    top: 0;
    float: left;

    overflow: hidden;

    display: block;
    width: 100px;
    height: 100px;

    margin: 0;
    padding: 0;

    background: #00aacc;
    border: 1px #ddff00 solid;

    color: #ffffff;
    font-family: Arial;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-transform: uppercase;

    cursor: move;

    @include border-radius(4px);
    @include box-shadow(1px 1px 0 #232323);
    @include transition(all 0.3s ease);

    &:hover
    {
        color: #cccccc;
    }

    @include pseudo('before')
    {
        content: '';

        width: 10px;
        height: 10px;

        background: #ff0000;
    }

}