GithubHelp home page GithubHelp logo

sassyplate's Introduction

SASS Boilerplate

For documentation and more information on SASS, refer to the official documentation:

Setup

Clone this repo into your project to be, or elsewhere and bring all the files in. Since this is a boilerplate and not an updatable framework you'll want to remove the .git directory. You'll likely want to remove .gitignore and use your project's .gitignore as this one excludes compiled css files.

The minimal .editorconfig file is in place for the development of the boilerplate and you may prefer a more specific one from your project too.

Location of directory to watch

The watched directory should be the theme directory, with your stylesheet directory being a child of that.

File structure

style.scss

This file is your main compiled stylesheet, and style.css should be included by your document.

This file acts as an asset manager and loads the following:

  • Libraries
  • Variables (fonts, colours, etc)
  • Mixins (reusable styles)
  • Modules (larger, self-contained, reusable units)
  • Partials (parts of styling broken off for maintainability)
  • A top-down stylesheet

Note that files are included in order of necessity. For example, variables can be used in mixins, modules, site styles, etc.

What about media queries?

Note that since SASS allows you to nest @media declarations, separate stylesheets containing media queries are unnecessary. Nesting @media declarations also reinforces a modular approach.

Libraries, variables, and mixins

An example of a SASS library is http://github.com/nathanshubert/Unicode-Shapes-Preprocessor-Library. They should be prefixed with an underscore, stored in the includes directory, and are included like such:

@import "includes/library-name";

Font Awesome

Font Awesome is included in the boilerplate by default. The font and icon variables are in includes/fontawesome, with the font files being located at fonts/fontawesome. When included variables are created for every icon, named matching the Font Awesome documentation (fortawesome.github.io/Font-Awesome/icons) For example, the Facebook icon would be

$icon-facebook

Other UI modules may rely upon these icon variables. If you want to replace them with say something from Icomoon, you'll need to provide these variables when excluding Font Awesome.

Modules

Self contained pieces of styling that can be reused. Modules should have the following characteristics:

  • Be context independent so they can be used anywhere.
  • Defined within a mixin so that they can be used easily, anywhere.
  • Be applied to a class that describes what the element IS, not what it looks like.
  • Contain their own variations, fallbacks, and possibly media queries

Buttons are a good example of a module.

Module files should be prefixed with an underscore, stored in the modules directory, and included like such:

@import "modules/module-name";

modules/_default-styles.scss

This module adds default styles to wysiwyg areas (maybe add a .wysiwyg for this?), most useful when using the Meyer reset. This isn't for generic site styles, which go in _base.scss.

_base.scss

Any global styling needed goes here. This shouldn't become an everything bucket ala the old school style.css file.

ie.scss

We no longer include a separate ie.css stylesheet. A separate IE stylesheet is reduced in importance by SASS allowing nested selectors like the following:

.thinger {
  .lt-ie8 & {
    display: none;
  }
}

This compiles as follows:

.lt-ie8 .thinger { display: none; }

Using these kinds of selects also allows code to be more maintainable my keeping all pieces of related code together. For instance, if you have styles for buttons, your buttons css can include the bass, fallbacks using Modernizr, media queries, and fallbacks for IE, all in the same declaration block.

If you need a more extensive IE stylesheet, ad one as needed.

sassyplate's People

Contributors

reubenmoes avatar igorbarbashin avatar nmwd avatar eriku avatar verticalgrain avatar

Stargazers

Nathan Shubert-Harbison avatar  avatar  avatar

Watchers

Alvin avatar Ben Holt avatar Andrew Hawthorne avatar  avatar Kurt Iverson avatar  avatar James Cloos avatar  avatar Lance Janocha avatar Nathan Shubert-Harbison avatar Harry Edwards avatar  avatar  avatar Justin Lim avatar Gurvir Cheema avatar Jakub Dobes avatar  avatar Anna Kviese avatar Jason Au avatar  avatar

sassyplate's Issues

Too much specificity on p,ul,ol in _base.scss

background: #14

I would be all for this:
_base.scss

p,ol,ul, li {
  margin: 0;
  padding: 0;
}
ol,li {
  list-style: none;
}
_wysiwyg.scss something along this line
  p,
  ol,
  ul {
    margin-top: 1em;
    margin-bottom: 1em;
    &:first-of-type {
        margin-top: 0;
    }
    &:last-of-type {
        margin-bottom: 0; 
    }
  }

Add susy

Susy seems pretty standard, at least for now. I think it makes sense to add it to the plate.

Add .scss-lint.yml for sass linting

Just copying this over from bitbucket
Erik's config file:

scss_files: 'assets/stylesheets/scss/**/*.scss'

linters:

  # Can now use either border: none; OR border: 0;
  BorderZero:
    enabled: false

  # Removes being limited to one style of commenting.
  # Allows for both inline & block comments
  Comment:
    enabled: false

  # Although this is set in .editorconfig, I set it here for linting purposes
  Indentation:
    character: space
    width: 2

  # Disabled because we use multiple naming conventions.
  # Allows for hyphens & underscores to be used
  NameFormat:
    enabled: false

  # Disabled for now as the FED team hasn't come up with a default order yet
  PropertySortOrder:
    enabled: false

  # I like keeping this in to alert me when there could be a @mixin that I
  # could use instead.
  VendorPrefixes:
    enabled: true

Consider addition of some generic print styles

So after our conversation this morning about default print stylesheets, I collected the stuff I use most often, and I think we could use it as place to start discussing what we'd need here.

I'm thinking that this is as close to default stuff as we'd probably want to go.

@media print {
    *, 
    *:before, 
    *:after {
        background: transparent !important;
        color: #000 !important; /* Black prints faster */
        box-shadow: none !important;
        text-shadow: none !important;
    } 

    a,
    a:visited {
        text-decoration: underline;
    }

    a[href]:after {
        content: " (" attr(href) ")";
    }

    abbr[title]:after {
        content: " (" attr(title) ")";
    }

    /*
     * Don't show links for images, or javascript/internal links
     */

    a[href^="javascript:"]:after,
    a[href^="#"]:after {
        content: "";
    }

    pre,
    blockquote {
        border: 1px solid #000;
        page-break-inside: avoid;
    }

    thead {
        display: table-header-group;
    }

    tr,
    img {
        page-break-inside: avoid;
    }

    img {
        max-width: 100% !important; /* Avoid images bleeding off the edges of the page */
    }

    p,
    h2,
    h3 {
        orphans: 3;
        widows: 3;
    }

    h2,
    h3 {
        page-break-after: avoid;
    }
    // Things to be hidden
    .sr-only, 
    a#skip-to-content {
      display: none;
    }
}

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.