Skip to content

SASS language elements (@mixin, @function, @if...) are not formated correctly #3282

Closed

Description

@yukulele

Prettier 1.8.2
Playground link

--parser scss

Input:

@mixin position($top   :   0   ,$right:null,$bottom:null,$left:null) {
  @if($right==null){$right: $top;}
  @if($bottom==  null){$bottom: $top;}
  @if($left   ==null){$left: $right;}
  position: absolute;
  top: $top;
  left: $left;
  right: $right;
  bottom: $bottom;
}

.aside{  @include position(0,2,    3,4) }

Output:

@mixin position($top   :   0   ,$right:null,$bottom:null,$left:null) {
  @if ($right==null) {
    $right: $top;
  }
  @if ($bottom== null) {
    $bottom: $top;
  }
  @if ($left ==null) {
    $left: $right;
  }
  position: absolute;
  top: $top;
  left: $left;
  right: $right;
  bottom: $bottom;
}

.aside {
  @include position(0,2,    3,4);
}

Expected output:

@mixin position ($top: 0, $right: null, $bottom: null, $left: null) {
  @if ($right == null) {
    $right: $top;
  }
  @if ($bottom == null) {
    $bottom: $top;
  }
  @if ($left == null) {
    $left: $right;
  }
  position: absolute;
  top: $top;
  left: $left;
  right: $right;
  bottom: $bottom;
}

.aside {
  @include position(0, 2, 3, 4);
}

Activity

  1. changed the title [-]scss language is not parsed correctly[/-] [+]Irregular spacing inside position(...) is not normalized[/+] on Nov 19, 2017
  2. added
    lang:css/scss/less
    on Nov 19, 2017
  3. changed the title [-]Irregular spacing inside position(...) is not normalized[/-] [+]scss language elements (@mixin, @function, @if...) are not formated correctly[/+] on Dec 1, 2017
  4. changed the title [-]scss language elements (@mixin, @function, @if...) are not formated correctly[/-] [+]SASS language elements (@mixin, @function, @if...) are not formated correctly[/+] on Dec 1, 2017
  5. yukulele commented on Feb 5, 2018

    @yukulele
    Author

    @evilebottnawi this doesn't fix my reported bug.
    args in @mixin, @function, @if, @include spaces are not reformatted.

    example

  6. alexander-akait commented on Feb 5, 2018

    @alexander-akait
    Member

    @yukulele we don't release new version with support this, see tests

    exports[`function.css 1`] = `

  7. added
    locked-due-to-inactivity
    on Jul 6, 2018
  8. locked as resolved and limited conversation to collaborators on Jul 6, 2018
  9. added theissue type on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:css/scss/lesslocked-due-to-inactivity

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions