Last active
March 30, 2019 12:25
-
-
Save niktariy/4a7d9a0dc73b7a407132d271cd4f632f to your computer and use it in GitHub Desktop.
Mixins in Sass VS Abandoned CSS @apply rule
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 1% | |
last 2 versions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Как могло бы быть в CSS*/ | |
/* @apply https://tabatkins.github.io/specs/css-apply-rule/ */ | |
:root { | |
--toolbar-theme: { | |
background-color: hsl(120, 70%, 95%); | |
border-radius: 4px; | |
border: 1px solid var(--theme-color late); | |
}; | |
--toolbar-title-theme: { | |
color: green; | |
}; | |
} | |
.toolbar { | |
@apply --toolbar-theme; | |
} | |
.toolbar > .title { | |
@apply --toolbar-title-theme; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// libsass (v3.5.4) | |
// ---- | |
// Уже есть в препроцессорах | |
@mixin toolbar-theme($theme-color: late) { | |
background-color: hsl(120, 70%, 95%); | |
border-radius: 4px; | |
border: 1px solid $theme-color; | |
} | |
@mixin toolbar-title-theme($title-color: green) { | |
color: $title-color; | |
} | |
.toolbar { | |
@include toolbar-theme(); | |
} | |
.toolbar > .title { | |
@include toolbar-title-theme(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.toolbar { | |
background-color: #e9fbe9; | |
border-radius: 4px; | |
border: 1px solid late; | |
} | |
.toolbar > .title { | |
color: green; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment