Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

sass-convert changes mixin parameter names #1096

Closed
badsyntax opened this Issue · 4 comments

3 participants

@badsyntax

Hi there.

This issue was identified and replicated using sass 3.2.14.

I have the following sass in a file test.scss:

@mixin fancy-mixin($max-width: 100%) {
  max-width: $max-width;
}
.hello {
  @include fancy-mixin($max-width: 200px);
}

I then use sass-convert on that sass:

sass-convert test.scss --to scss

...and it outputs:

@mixin fancy-mixin($max-width: 100%) {
  max-width: $max-width;
}

.hello {
  @include fancy-mixin($max_width: 200px);
}

Notice the parameter name when calling fancy-mixin changes from $max-width to $max_width.

@badsyntax badsyntax referenced this issue in badsyntax/SassBeautify
Closed

Possible Dasherize issue #31

@HugoGiraudel

Both are equivalent in Sass: $a-b and $a_b are the same. Same for function and mixin names.

The reason behind this is hyphens/underscores should be a matter of aesthetics and conventions, not a language feature. At least that's what I remember from an old reply from Nathan.

@badsyntax

Thanks for the reply @HugoGiraudel

TIL! Ok I think I understand that response. So hyphens and underscores are treated the same, and it's a matter of aesthetics and conventions. With that understanding, sass-convert should not enforce conventions onto the user, the hyphen should not be converted to an underscore.

I've struggled to find any official documentation about this in the sass documentation, I've only found documentation from blogs.

@HugoGiraudel

sass-convert should not enforce conventions onto the user, the hyphen should not be converted to an underscore.

Fair point. This is definitely a bug, but most certainly not an important one since it has absolutely no repercussion over the code.

@nex3 nex3 closed this
@badsyntax

Thanks @nex3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.