0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

scssのmixinであらかじめ定義されている変数リストを使用できるようにする

Posted at

宴もたけなわでございますが、こう書けば良い。

意外に参考書とかネット記事を探しても見当たらなかったから苦戦しました。
カラーマネジメントとかでも頻繁に使えそうなので重宝しそうです。

@import url(http://fonts.googleapis.com/earlyaccess/notosansjp.css);

$weights: (
    'regular': 400,
    'medium': 700
) !default;

@mixin notoFont ($weight: medium) {
    font-family: 'Noto sans jp';
    font-weight: #{map-get($weights, $weight)};
}

$colors: (
    'black': '#000',
    'white': '#fff',
    'error': '#f00'
) !default;

@mixin color ($color: black) {
    color: #{map-get($colors, $color)};
}

p {
    @include notoFont();
    @include color();
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?