Error when trying to compile SASS code

Rost

I'm using Sass for styles. When i try to compile this part of code:

.heart {
  width: $size * 2;
  height: $size * 1.65;
  cursor: pointer;

  &:before {
    position: absolute;
    content: "";
    left: $size;
    width: $size;
    height: $size * 1.65;
    background: #fff;
    border-radius: 50px 50px 0 0;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
  }
  &:after {
    @extend .heart:before;
    left: 0;
    transform: rotate(45deg);
    transform-origin :100% 100%;
  }
}

I got this message:

@extend .heart:before;
Error: compound selectors may longer be extended.
Consider `@extend .heart, :before` instead.
See http://sass-lang.com/documentation/file.SASS_REFERENCE.html#extending_compound_selectors for details.

@extend .heart:before;

It doesn't compile with terminal, but it's compile and works as expected with Prepros application. Any ideas why it doesn't work when i try to compile with sass command?

I used this example: https://codepen.io/souporserious/pen/yEntv

J Quest

I think you need to create a placeholder like this; Also I know that there are some bugs in command line compiling with @extand and pseudo-elements around 2016.

%placeholder {
    position: absolute;
    content: "";
    left: $size;
    width: $size;
    height: $size * 1.65;
    background: #fff;
    border-radius: 50px 50px 0 0;
    transform: rotate(-45deg);
    transform-origin: 0 100%;
}

.heart {
  width: $size * 2;
  height: $size * 1.65;
  cursor: pointer;

  &:before {
    @extend %placeholder;
  }
  &:after {
    @extend %placeholder;
    left: 0;
    transform: rotate(45deg);
    transform-origin :100% 100%;
  }
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Make Error 127 when running trying to compile code

Compilation results in an error when trying to compile code containing binary ifstream

Compile error when converting less to sass

Terminal error message when trying to install Sass

Illegal Character when trying to compile java code

Compile error when trying to use increment operator

Namespace not found error when trying to compile

Compile error when trying to run make

Compile error when trying to install qjournalctl

Why do I get the error "cannot find -lcurl" when trying to compile example code?

Error when compiling Sass in Visual Studio Code

SASS Module Error when trying to use @use rule

Error when installing and trying to get version of SASS via Terminal

NPM Error When Trying To Install node-sass

NPM - node sass error when trying to install dependency

boost::spirit -- compiler error trying to compile most simple code

Compile Error: Invalid Outside Procedure on code trying to ping multiple servers

SCSS will not compile, SASS error, no .sass files

gcc doesn't do anything when trying to compile a code

Ambiguous errors when trying to compile C++ code

ERROR when trying to compile protoc files: file not found or had errors

Compile Error when trying to return PChar or OleVariant for UDF

Golang: compile error when trying to delete an item in map

Compile error when trying to print an integer in Rust v0.13.0

Got compile error when trying to invoke function pointer to member functions

Compile type error when trying to return Extendable record

Compile error when trying to use std::result_of

GFortran error: ld: library not found for -lSystem when trying to compile

Maven crashes when trying to compile a project "Error executing Maven."