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

New Rule: Empty Args #38

Closed
Snugug opened this issue Aug 28, 2015 · 6 comments
Closed

New Rule: Empty Args #38

Snugug opened this issue Aug 28, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@Snugug
Copy link
Member

Snugug commented Aug 28, 2015

With Sass, if a function or mixin doesn't have any arguments, the parenthesis can be left off of the definition and, in the case of mixins, the invocation as well

@Snugug Snugug added the rule label Aug 29, 2015
@bgriffith
Copy link
Member

Started to look into this one. Experience is slightly different. Parenthesis can be left off of the definition of mixins but not functions. When I try I get a Sass error;
@function baz ": expected "(", was "{"

While I can drop the parenthesis off both the invocation of functions and mixins.

// Causes an error
@function baz {
  @return 'baz';
}

// Is ok
.baz {
  content: baz;
}

// Is ok
@mixin qux {
  content: 'baz';
}

// Is ok
.qux {
  @include qux;
}

@Snugug
Copy link
Member Author

Snugug commented Sep 1, 2015

Check out this Sass Meister:
http://sassmeister.com/gist/17649e207a82c4efb946

The function isn't being invoked if it doesn't include (), you just happen to have named the function and its return the same, making it appear to be OK.

There is, however, a discrepancy between Libsass and Ruby Sass as to whether a function can be defined w/o (). Libsass allows it, Ruby Sass does not.

@bgriffith
Copy link
Member

Haha oh dear. Amateur mistake! Libsass are working towards parity with Ruby Sass so do you agree that this rule should be mixin only?

@Snugug
Copy link
Member Author

Snugug commented Sep 1, 2015

I trusted you man! I trusted you! 😝

@bgriffith
Copy link
Member

Hahaha 😁 - Thoughts on above?

@Snugug
Copy link
Member Author

Snugug commented Sep 1, 2015

Yah, only for mixins makes sense to me

@bgriffith bgriffith self-assigned this Sep 1, 2015
@DanPurdy DanPurdy added this to the 1.2.0 milestone Sep 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants