Kitty Giraudel
Non-binary accessibility & diversity advocate, frontend developer, author. Real life cat. They/she.
It's old. It's really old.It can't be changed.It operates in a global namespace.It's based on inheritance.It's very, very loose.Source order is critical.The cascade needs managing.Specificity negates all the above.
sass/
|
|- main.scss
|- layout.scss
|- typography.scss
|- grid.scss
|- print.scss
|- variables.scss
|- mixins.scss
|- responsive.scss
|- home.scss
|- contact.scss
|- carousel.scss
|- bootstrap.scss
sass/
|
|– base/
| |– _reset.scss
| |– _typography.scss
|
|– components/
| |– _carousel.scss
| |– _dropdown.scss
|
|– helpers/
| |– _variables.scss
| |– _mixins.scss
| |– _helpers.scss
|
|– layout/
| |– _grid.scss
| |– _header.scss
| |– _footer.scss
| |– _sidebar.scss
|
|– pages/
| |– _home.scss
| |– _contact.scss
|
|– vendors/
| |– _bootstrap.scss
| |– _jquery-ui.scss
|
`– main.scss
@import "utils/variables";
@import "utils/functions";
@import "utils/mixins";
@import "utils/placeholders";
@import "vendors/bootstrap";
@import "vendors/jquery-ui";
@import "base/reset";
@import "base/typography";
@import "layout/grid";
@import "layout/header";
@import "layout/footer";
@import "layout/sidebar";
@import "components/carousel";
@import "components/buttons";
@import "components/cover";
@import "components/dropdown";
@import "pages/home";
@import "pages/contact";
Erreur, merci de faire quelque chose !
Tout est OK, veuillez circuler.
Vous devriez peut-être faire attention.
Petite information...
$slider-space: 1em;
$slider-color: #666;
$slider-border: false;
$slider-speed: 3s;
$slider-transition: 150ms ease-in-out;
$slider: (
space: 1em,
color: #666,
border: false,
speed: 3s,
transition: 150ms ease-in-out
);
$overflow: hidden;
$white-space: pre;
$float: left;
$color: #333;
$font-size: 1.2em;
$border: 1px solid;
.element {
overflow: $overflow;
white-space: $white-space;
float: $float;
color: $color;
font-size: $font-size;
border: $border;
}
.block {
...
}
.block--modifier {
...
}
.block__element {
...
}
.block__element--modifier {
...
}
.slider {
overflow: hidden;
transition: $slider-transition;
}
.slider--home {
background: $slider-color;
}
.slider__slide {
float: left;
}
.slider__slide--full {
background-size: cover;
}
.block {
...
&--modifier {
...
}
&__element {
...
&--modifier {
...
}
}
}
Vous allez voir...
C'est hyper simple !
Mais il faut juste faire attention.
A ne pas faire n'importe quoi !
$message-types: (
(error #b94a48)
(valid #468847)
(warning #c09853)
(info #3a87ad)
);
$message-types: (
error : #b94a48,
valid : #468847,
warning : #c09853,
info : #3a87ad
);
%message {
padding: .5em;
margin-bottom: .5em;
border-radius: .15em;
border: 1px solid;
}
@mixin message($color) {
// On inclue les styles de base
@extend %message;
// Puis les styles spécifiques au type
color: $color;
border-color: lighten($color, 20%);
background-color: lighten($color, 40%);
}
@each $message-type in $message-types {
$type : nth($message-type, 1);
$color : nth($message-type, 2);
.message-#{$type} {
@include message($color);
}
}
@each $type, $color in $message-types {
.message-#{$type} {
@include message($color);
}
}
$message-types: (
error : #b94a48,
warn : #c09853,
valid : #468847,
info : #3a87ad
);
%message {
padding: .5em;
margin: .5em;
border-radius: .15em;
border: 1px solid;
}
@mixin message($color) {
@extend %message;
color: $color;
border-color: lighten($color, 20%);
background-color: lighten($color, 38%);
}
@each $type, $color in $message-types {
.message-#{$type} {
@include message($color);
}
}
.message-error, .message-warn, .message-valid, .message-info {
padding: .5em;
margin: .5em;
border-radius: .15em;
border: 1px solid;
}
.message-error {
color: #b94a48;
border-color: #d59392;
background-color: #efd5d4;
}
.message-warn {
color: #c09853;
border-color: #dbc59e;
background-color: #f4ede1;
}
.message-valid {
color: #468847;
border-color: #7aba7b;
background-color: #b6dab7;
}
.message-info {
color: #3a87ad;
border-color: #7ab5d3;
background-color: #bfdcea;
}
@HugoGiraudel
By Kitty Giraudel
Non-binary accessibility & diversity advocate, frontend developer, author. Real life cat. They/she.