fullstackplus / sass-project-organization

How I organize SASS stylesheets within a Rails or Sinatra project

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#SASS (SCSS) project structure

A structure for SASS files and folders I'm using in Rails and Sinatra projects. A few guiding principles:

  1. A uniform import interface
  2. No circular imports
  3. No import hierarchies / chains

Every folder has an all.scss file that lists every SASS file in that folder. A folder at level N will import every folder at level N-1 via the latter's all.scss file.

There are 3 directories:

  • base/ for styles and functions that don't change in development
  • modules/ for styles that change, i.e. are used to build the app
  • vendor/ for third-party stylesheets and things like icon fonts.

Every file in modules/ imports every file in base/, essentially treating this dir as a single file. So from this point of view, every SASS module is the same in what it needs to know about other files. Convention over configuration.

License (MIT)

Copyright (c) [2014] [James Abbott]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

How I organize SASS stylesheets within a Rails or Sinatra project


Languages

Language:CSS 100.0%