Git Product home page Git Product logo

sass-build-structure's Introduction

Evernote SASS Structure Boilerplate

After reading the book SMACSS and finding it very helpful the Front End team at Evernote has used some of the ideas in our SASS build. We've found breaking the SASS files out into directories (Base, Layout, Modules, and Themes) helps organize your files in a project and compile CSS into a clean, logical file. Each page has a SASS (.scss) file created that acts as a project file that imports the individual modular components from Base, Layout, Modules, and Themes that are needed to build the particular page.

This build methodology is currently being used on Evernote.com.

SASS Directories

  1. Base

    The base directory contains styles that help start a project. The base directory could contain the following type of SASS files:

    • Vendor dependancies (Compass, Foundation)
    • Authored dependancies (Mixins, variables, Extends)
    • Fonts
    • Reset
  2. Layout

    The layout directory contains styles that are large containers of a page. This directory could include SASS files like:

    • Responsive Grid
    • Page specific layouts
  3. Modules

    The modules directory will probably contain the bulk of your SASS files. A page may consist of multiple modules and should be style individually. These modules may include files like:

    • Header
    • Footer
    • Navigation
    • Content Block
  4. Themes

    The themes directory contains any specific styles that a page may need to change from the generic layout or modules. For example the header in your website maybe green throughout a website or application but on a specific page you want it to change to a blue background that's where the themes files would come in.

Rules

  • There should only be a maximum of 2 CSS files per page ( this prevents HTTP requests )
  • One line for each selector or rule
  • List related items together
  • Only nest 3 levels deep
  • Break files out into small modules (avoid having a SCSS file that is larger than 100 lines)
  • Avoid using IDs throughout the site. Use IDs for parent elements. Example: Header, Footer, Main. Using Classes avoids having to use !important
  • Be generous with commenting
  • If a :hover pseudo class is styled, :focus should also be styled for accessibility.

Commenting

  • Using "// " for your comments in SASS and they will not output in the compiled CSS

Variables

  • Any values commonly throughout the SASS build should be set as a variable (fonts, colors, percentages, z-index)
  • All colors should be variables

Order of imports

  • Vendor dependancies (compass)
  • Authored dependancies (Mixins, variables)
  • Base styles ( reset, fonts, typography )
  • Layout styles
  • Modules styles
  • Theme styles

sass-build-structure's People

Contributors

ryanburgess avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.