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

Deprecate function and mixin names beginning with -- #2230

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Apr 27, 2024

See #2197
See sass/sass#3854
See sass/sass-spec#1982
[skip sass-embedded]

@nex3 nex3 requested a review from Goodwine April 27, 2024 00:05
@nex3 nex3 force-pushed the css-function-mixin-preparation branch from a50aed9 to e911af1 Compare April 27, 2024 00:10
@nex3 nex3 merged commit 264b2d5 into main Apr 30, 2024
29 checks passed
@nex3 nex3 deleted the css-function-mixin-preparation branch April 30, 2024 21:20
@WebMechanic
Copy link

WebMechanic commented May 7, 2024

Hello,

I updated to 1.77.0 and noticed this also affects mixins starting with double underscores such as @mixin __fubar() and their @include __fubar().

If this is intended it should probably be mentioned in the documentation

We only had a couple of old mixins using the __ prefix to mark them as "private". No big deal as the warning in the console was very helpful.

Bye.

@Goodwine
Copy link
Member

It was intended. Underscores and hyphens are equivalent in Sass identifiers. We assume users are familiar with that fact, but I understand it may not be obvious.

From the docs:

Mixin names, like all Sass identifiers, treat hyphens and underscores as identical. This means that reset-list and reset_list both refer to the same mixin.

https://sass-lang.com/documentation/at-rules/mixin/

@WebMechanic
Copy link

Thanks, indeed not so obvious :-)
From this example with the inline hyphens and underscores, I had never deduced that this also applies to prefixes which most languages handle very differently -- except CSS and as I learned now, Sass.
It's always these "little things" that cause confusion :-)

@nex3
Copy link
Contributor Author

nex3 commented May 15, 2024

I think @WebMechanic is right that this is a bug. The spec is ambiguous here, and there's not a strong reason for us to forbid functions from being written and referenced with double leading underscores.

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

Successfully merging this pull request may close these issues.

None yet

3 participants