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

Custom rem() function no longer being overridden as of v1.65 #2064

Closed
amxmln opened this issue Aug 14, 2023 · 2 comments
Closed

Custom rem() function no longer being overridden as of v1.65 #2064

amxmln opened this issue Aug 14, 2023 · 2 comments

Comments

@amxmln
Copy link

amxmln commented Aug 14, 2023

I have a custom rem() function defined that turns a pixel value into a rem-Value:

@use 'sass:math';

@function rem($pixels) {
  @if type-of($pixels) == 'number' and not unitless($pixels) {
    @return math.div(math.div($pixels, $pixels * 0 + 1), 16) * 1rem;
  }

  @return math.div($pixels, 16) * 1rem;
}

$max-content-width: rem(1296);

As of v1.65, SASS supports the CSS rem() function, which returns the remainder of a division. Of course, the two functions clash, but I was under the impression that a user-defined function would always override a native function. However, this does not seem to be the case, as the last line in the above snippet throws:

Error: 2 arguments required, but only 1 was passed.
   ╷
11 │ $max-content-width: rem(1296);
   │                     ^^^^^^^^^
   ╵
  src/assets/styles/helpers.scss 11:21  @use

This is unexpected—am I doing something wrong, or is this a regression?

@amxmln
Copy link
Author

amxmln commented Aug 14, 2023

Sorry, hadn’t noticed this is a duplicate of #2059 and other issues, since the titles were a bit cryptic.

@amxmln amxmln closed this as completed Aug 14, 2023
@nex3
Copy link
Contributor

nex3 commented Aug 17, 2023

I've reopened sass/sass#3504 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants