Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass treats `_` and `-` in variable name are same? #1114

Closed
hail2u opened this Issue Feb 14, 2014 · 2 comments

Comments

Projects
None yet
2 participants
@hail2u
Copy link

hail2u commented Feb 14, 2014

The following code should return a compile error, “Undefined variable: "$foo_bar". (Sass::SyntaxError)”:

$foo-bar: "foo-bar";

.test {
  content: $foo_bar;
}

But compile successfully without any warnings:

.test {
  content: "foo-bar"; }

Tested on: Sass 3.3.0.rc.3 with ruby 2.0.0p353 (2013-11-22) [x64-mingw32]

@nex3

This comment has been minimized.

Copy link
Contributor

nex3 commented Feb 14, 2014

This is the expected behavior. When Sass introduced the SCSS syntax, it added support for hyphenated variable and mixin names at the same time. In order to provide backwards compatibility with existing libraries, we decided that we'd make the new hyphen syntax interchangeable with underscores. Since then it hasn't been worth the pain of breaking compatibility to undo.

@nex3 nex3 closed this Feb 14, 2014

@hail2u

This comment has been minimized.

Copy link
Author

hail2u commented Feb 14, 2014

Thanks, I understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.