G
G
Grigory Vasilkov2016-12-21 10:26:34
css
Grigory Vasilkov, 2016-12-21 10:26:34

How to pass styles as a parameter to a mixin?

I want to write a mixin like this:
@mixin media(device, styles) {}
which is called like this
$gte-xxl = 1200
@mixin media(gte-xxl, styles);
Does anyone know how to do this or what are the project development practices to avoid doing this?
I can't afford to write min-width/max-width every time, knowing that tomorrow we will start supporting a new device and half of the styles will have to be rewritten.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Serj-One, 2016-12-21
@gzhegow

It is not entirely clear what exactly you are going to pass to the mixin.

$xs: ('max-width:767px');
@media ($xs) {...}

Then you just add to the class
.block{
  ... // изначальные свойства
  @media ($xs) {
  ... // свойства блока для $xs
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question