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
Closed

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

hail2u opened this issue Feb 14, 2014 · 2 comments

Comments

@hail2u
Copy link

@hail2u 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
Copy link
Contributor

@nex3 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
Copy link
Author

@hail2u 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
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants