structure your sass badcamp 2013

16
Structure Your SASS Drupal.org Github Twitter } penguininja

Upload: penguininja

Post on 27-Jan-2015

113 views

Category:

Technology


0 download

DESCRIPTION

So you've heard of SASS, maybe you're using it already. Look how pretty it makes your code! That is until you get a list, in a block, that comes from a view, that also uses some mixins and a media query. How does the SASS code structure fit in with your Drupal theme? What if you want to use your own grid? Should you put those rules in a separate stylesheet or maybe a partial? (Wait, what's a partial??) This session will cover: - How to most effectively use SASS variables, mixins, extends, partials, and more - An intro to how the popular Zen base theme uses SASS out-of-the-box - How to use SASS to make your theme (and your design!) more semantic - An intro to SMACSS (Scalable and Modular Architecture for CSS) - How to easily go from prototype to theme, without duplicating your work And will raise even more questions, such as: - Where did all these media queries come from? And.. - Where did my line numbers go and how do I get them back?! The target audience is proficient in CSS and interested in making the most out of the SASS (Syntactically Awesome Stylesheets) for their next Drupal theme or project.

TRANSCRIPT

Page 1: Structure Your SASS   BADcamp 2013

Structure Your SASS

Drupal.orgGithubTwitter } penguininja

Page 2: Structure Your SASS   BADcamp 2013

CSS: What’s the Problem?

● Coding Standards● Predictability● Reusability● Semantic Markup

Page 3: Structure Your SASS   BADcamp 2013

Enter SMACSS

(Scalable and Modular Architecture for CSS)

Jonathan Snook : smacss.com

Page 4: Structure Your SASS   BADcamp 2013

SMACSS Basics

● General to Specific● Identify Patterns● Modules as Standalone

Components● Increase Semantics

Page 5: Structure Your SASS   BADcamp 2013

SMACSS Organization

1. Base2. Layout3. Module4. State5. Theme

Page 6: Structure Your SASS   BADcamp 2013

Still Some Issues...

● Non-Semantic Classes● Not enough control over

Drupal markup

Semantic Class Names : css-tricks.com/semantic-class-names

Page 7: Structure Your SASS   BADcamp 2013

Make it Better with SASS

Semantic Grids

Zen Gridszengrids.comThe Semantic Grid Systemsemantic.gsSimple Semantic Grid : github.com/penguininja/simple-semantic-grid

Page 8: Structure Your SASS   BADcamp 2013

Semantic Grids$max-width: 960px;

article {@include column(9);

}

aside {@include column(3);

}

Page 9: Structure Your SASS   BADcamp 2013

Make it Better with SASS

● Increased Reusability● Cleaner Module Code● Style Tile Integration

Use Mixins

Page 10: Structure Your SASS   BADcamp 2013

Make it Better with SASS

Use Partials to Reduce Number of Stylesheets While Staying Modular

Page 11: Structure Your SASS   BADcamp 2013

SASS Partials

@import “base”;@import “layout”;@import “navigation”;@import “widget”;

Page 12: Structure Your SASS   BADcamp 2013

Make it Better with SASS

● Nest Media Queries● Group All Module Styles

Together

Page 13: Structure Your SASS   BADcamp 2013

Media Queries.widget {

width: 50%;

@media screen and (max-width: 600px) {width: 100%;

}}

Page 14: Structure Your SASS   BADcamp 2013

Example: Zen 5.4

Page 15: Structure Your SASS   BADcamp 2013

Don’t Panic!

Page 16: Structure Your SASS   BADcamp 2013

Questions?

Drupal.orgGithubTwitter } penguininja