responsive with sass and compass

22
Responsive with Sass & Compass

Upload: david-malinowicz

Post on 30-Oct-2014

1.331 views

Category:

Technology


4 download

DESCRIPTION

Responsive Web Design presentation for Drupal User Group Toronto. Presented by Romain Nirennold from Therefore Interactive.

TRANSCRIPT

Page 1: Responsive with SASS and compass

Responsivewith

Sass & Compass

Page 2: Responsive with SASS and compass

Introduction

Page 3: Responsive with SASS and compass

Summary

- What are Sass and Compass?

- How to install and run?

- Toolkit extension

- SVG Background

- Vertical Rhythm

- Singularity

- Breakpoint

Page 4: Responsive with SASS and compass

SASS & Compass

Sass: Extension of CSS3 adding rules, variables, mixins, selectors, functions...

Compass: Open-source CSS Authoring Framework.

- add various mixins to Sass

- documentation: http://compass-style.org

Page 5: Responsive with SASS and compass

Install & Run

Pre-requirements: having Ruby Gems installed (pre-installed on Mac).

In the terminal:

> sudo gem install compass (install the lastest version)

> compass create project-name (add directories and files)

> cd project-directory

> compass install compass

> compass watch sass-directory

*new project / *existing project

Page 6: Responsive with SASS and compass

Install & Run

Pre-requirements: having Sass and Compass installed.

In the terminal:

> gem install extension-name

In config.rb file:

> require ‘extension-name’

In .scss file:

> @import ‘extension-name’

Page 7: Responsive with SASS and compass

Toolkitresponsive web design tool

Page 8: Responsive with SASS and compass

SVG Background

Mixin generating SVG background images with PNG fallbacks.

How?

- create a directory for images containing SVG and PNG

Result?

- use SVG for background images

- generate a PNG sprite (ex: IE8 or old android browsers)

- use parameters (ex: $with-dimensions: false)

Page 9: Responsive with SASS and compass
Page 10: Responsive with SASS and compass

Vertical Rhythm

“The spacing and arrangement of text as the reader descends the page – is contributed to by three factors: font size, line height and margin or padding.”

Font-size and line-height:

- Define a base font-size and line-height

- When font-size changes, line-height is recalculated

Page 11: Responsive with SASS and compass

Vertical Rhythm

Margin and padding:

- Use the function rhythm()

- Calculate a value in em using the font-size of the text of the container

Page 12: Responsive with SASS and compass

SingularityGrid framework for responsive design

Page 13: Responsive with SASS and compass

Singularity

- Set a grid as a global layout context

- $grids: number of columns, $gutters: space between columns

- Symmetric (12), asymmetric (8 4) and responsive grids

- Use the “grid-span” mixin: grid-span(span, location)

+ Output style: method of width calculation to align items

+ Span: how many columns you want to span

+ Location: mixin to add a grid inside the general context

- Various options and tools to use (grid-toggle, different outputs...)

Page 14: Responsive with SASS and compass

Singularity

Page 15: Responsive with SASS and compass

Singularity

Page 16: Responsive with SASS and compass

Singularity

Page 17: Responsive with SASS and compass

Singularity

Page 18: Responsive with SASS and compass

BreakpointMedia queries in sass

Page 19: Responsive with SASS and compass

Breakpoint

- Mixing that makes writing media queries in Sass simple

- Single and pairs ($pair: 456px 794px;) queries

- Media types: 'not screen'...

- Multiple feature: types, orientation, resolution

Page 20: Responsive with SASS and compass

Breakpoint

Page 21: Responsive with SASS and compass

Breakpoint

Page 22: Responsive with SASS and compass

thanks!SASS

http://www.youtube.com/watch?v=fbVD32w1oTo&list=PL2CB1F80266E986EA

http://sassmeister.com/

Compass

http://www.youtube.com/playlist?list=PL45DD77A4CCA76ED3

Compass Extensions

https://github.com/Team-Sass/toolkit

https://github.com/Team-Sass/breakpoint

https://github.com/Team-Sass/Singularity