sasset:understanding_sass
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
| — | sasset:understanding_sass [2016/03/30 21:03] (current) – created leo | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | |<- [[Using the exercise files]]|[[Analyzing installation options]] ->| | ||
| + | ==== What is SASS ==== | ||
| + | |||
| + | * une extensions à CSS | ||
| + | * un langage pré-processé | ||
| + | * est extensible via des plugins (Compass, ???, Susy) | ||
| + | * écrit en Ruby | ||
| + | |||
| + | ==== Features ==== | ||
| + | |||
| + | * variables | ||
| + | * nesting | ||
| + | * partials : permet des séparer le CSS en modules | ||
| + | * extend : sorte d' | ||
| + | * Opérateurs | ||
| + | * Mixins : macros, semblable à ajouter du javascript dans son CSS | ||
| + | |||
| + | ==== Syntaxe ==== | ||
| + | |||
| + | === SASS === | ||
| + | |||
| + | * Avantage : très concis. | ||
| + | * Peut-être pas pour le débutant en SASS. | ||
| + | |||
| + | < | ||
| + | .classe | ||
| + | ul | ||
| + | margin: 0 | ||
| + | li | ||
| + | float: left | ||
| + | </ | ||
| + | === SCSS === | ||
| + | |||
| + | * Syntaxe plus récente | ||
| + | * La même chose que SASS hormis l' | ||
| + | * Avantage : possibilité d' | ||
| + | |||
| + | < | ||
| + | .classe { | ||
| + | ul { | ||
| + | margin: 0 | ||
| + | li { | ||
| + | float: left | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | |||
| + | </ | ||
| + | ==== Exemples ==== | ||
| + | |||
| + | === Variables === | ||
| + | < | ||
| + | $rouge : #ff000; | ||
| + | $bleu : #0000ff; | ||
| + | </ | ||
| + | === nesting === | ||
| + | < | ||
| + | .classe { | ||
| + | //styles | ||
| + | ul { | ||
| + | // styles | ||
| + | li { | ||
| + | //styles | ||
| + | } | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | === Partials === | ||
| + | < | ||
| + | @import " | ||
| + | </ | ||
| + | === Extend === | ||
| + | < | ||
| + | .mon_style { color: $red; } | ||
| + | .mon_style_etendu { | ||
| + | @extend .mon_style; | ||
| + | background: $bleu; | ||
| + | } | ||
| + | </ | ||
| + | === Opérateurs === | ||
| + | < | ||
| + | $bordure: 1px; | ||
| + | $bordure_epaisse: | ||
| + | |||
| + | .sidebar { | ||
| + | @if ($bordure< | ||
| + | background: $rouge; | ||
| + | } @else { | ||
| + | background: $bleu; | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | === Mixins === | ||
| + | @mixin rounded($radius: | ||
| + | border-radius: | ||
| + | } | ||
| + | ul { | ||
| + | li img { | ||
| + | @include rounded(20px); | ||
| + | } | ||
| + | } | ||
sasset/understanding_sass.txt · Last modified: 2016/03/30 21:03 by leo