D
D
Djoni Kage2022-03-24 14:50:49
Sass
Djoni Kage, 2022-03-24 14:50:49

Why doesn't the :before mixin work?

terminal gives an error I don't understand what's the problem?

mistake

┌──> app\scss\_mixin.scss
18 │   @mixin pseudo(
   │ ┌────────^
19 │ │   $width,
20 │ │   $height,
21 │ │   $content: "",
22 │ │   $display: block,
23 │ │   $pos: absolute,
24 │ │   $bgp: center,
25 │ │   $bgr: no-repeat,
26 │ │   $bgs: cover
27 │ │ ) {
   │ └─^ declaration
   ╵
  app\scss\style.scss 14:5  root stylesheet
    relativePath: app\scss\style.scss
    domainEmitter: [object Object]
    domainThrown: false

mixin
@mixin pseudo(
  $width,
  $height,
  $content: "",
  $display: block,
  $pos: absolute,
  $bgp: center,
  $bgr: no-repeat,
  $bgs: cover
) {
  content: $content;
  display: $display;
  position: $pos;

  width: $width;
  height: $height;

  background-position: $bgp;

  background-repeat: $bgr;

  background-size: $bgs;
}


style.scss

&__item::before {
    @include pseudo
  (
      110px,
      40px,
      $bgp,
      $bgr,
      $bgs,
      $content: "",
      $display: block,
      $pos: absolute)
    {

      }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ilya Olovyannikov, 2022-03-24
@cannibal_corpse

1. Why a mixin for pseudo?
2. With absolute positioning, display: block is redundant (see computed styles)
3. You're using the mixin incorrectly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question