atlanta drupal users group - lightning talks - sass

13
Sass Your Drupal Themes Presented By Eric Scott Sembrat Georgia Tech: College of Engineering March 2014: Atlanta Drupal Users Group

Upload: eric-sembrat

Post on 05-Dec-2014

568 views

Category:

Education


2 download

DESCRIPTION

A short primer on why Sass is so sassy for theme development and maintenance!

TRANSCRIPT

Page 1: Atlanta Drupal Users Group - Lightning Talks - Sass

Sass Your Drupal Themes

Presented By Eric Scott SembratGeorgia Tech: College of Engineering

March 2014: Atlanta Drupal Users Group

Page 2: Atlanta Drupal Users Group - Lightning Talks - Sass

Veronica Mars agrees...

CSS is a chore to use in today’s web.

Page 3: Atlanta Drupal Users Group - Lightning Talks - Sass

Media Queries

Breakpoints

Grid Frameworks

Vendor-Specific CSS3

Repeating CSS

Everywhere

Page 4: Atlanta Drupal Users Group - Lightning Talks - Sass

How do we fix this?

This is where Sass saves the day!

Page 5: Atlanta Drupal Users Group - Lightning Talks - Sass

Introducing Sass

Sass is a stylesheet language to pre-process CSS styling.

file.scss file.css

compilationmagic

Page 6: Atlanta Drupal Users Group - Lightning Talks - Sass

What’s the big deal?

What can we do with Sass, anyways?

Page 7: Atlanta Drupal Users Group - Lightning Talks - Sass

Nested Rules

#main { background-color: #FFCBDB; color: #666666;

}

.warning { background-color: #FF0000; color: #000000;}

#main { background-color: #FFCBDB; color: #666666;}

#main .warning { background-color: #FF0000; color: #000000;}

Nesting allows you to apply the same clean, hierarchy-driven visual makeup of HTML to CSS.

Page 8: Atlanta Drupal Users Group - Lightning Talks - Sass

Variables & Functions

$radyellow: #EEAD0E;

#main { background-color: $radyellow; color: darken($radyellow, 30%);}

#main { background-color: #EEAD0E; color: #5e4406;}

Works with any CSS value you can think of!

Page 9: Atlanta Drupal Users Group - Lightning Talks - Sass

Operators

#main { $localwidth: 500px; .panel { width: $localwidth/10; }}

#main .panel { width: 100px;}

Computing grid-layouts and element placement is no longer a chore.

Let Sass do the number-crunching for you.

Page 10: Atlanta Drupal Users Group - Lightning Talks - Sass

Mixins

@mixin atlantafun() {$atl_peach: #FFD8AD;background-color: $atl_peach;}

body { .view-grid { @include atlantafun(); }}

body .view-grid {background-color: #FFD8AD;}

Mixins define a group of CSS declarations that you can reuse throughout your theme. These

mixins can even include arguments.

Page 11: Atlanta Drupal Users Group - Lightning Talks - Sass

Partials

Partials allow for compartmentalizing of your CSS into separate Sass files.

file.scss file.css

compilationmagic

_header.scss

_footer.scss

Page 12: Atlanta Drupal Users Group - Lightning Talks - Sass

Ready to learn?

http://sass-lang.com/guide

Page 13: Atlanta Drupal Users Group - Lightning Talks - Sass

Twitter - @esembratWeb - http://ericsembrat.comEmail - [email protected]

That’s all, folks!