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

Upgrade sass to namespaced built-ins #64

Open
GregOriol opened this issue Dec 5, 2024 · 5 comments
Open

Upgrade sass to namespaced built-ins #64

GregOriol opened this issue Dec 5, 2024 · 5 comments

Comments

@GregOriol
Copy link

Recent versions of sass introduce namespaced built-ins: sprite templates in this project use the nth function, which now should be requested with a @use "sass:list"; at the beginning of the file, and then referred to with list.nth.

@twolfson
Copy link
Owner

twolfson commented Dec 6, 2024

Thanks for writing in! I'm struggling to find the "should be requested" piece in the documentation (found the "no conflict" benefit, but we aren't defining anything new for lists?). Can you link me to that?

One big concern I have is this only seems to be supported by Dart Sass, which breaks support for both LibSass and Ruby Sass.

https://sass-lang.com/documentation/modules/list/

@GregOriol
Copy link
Author

@twolfson The templates are using the nth function, which is in the newer versions of sass part of the "list" built-in module as per https://sass-lang.com/documentation/modules/list/

By requested, I meant that the function won't be just used by itself as before, but there should be the addition of the @use "sass:list"; declaration at the beginning and the call with list.nth namespacing.

I'm not sure how it would be possible to support both syntaxes. Maybe by having a way to select which templates one would like to use with "sass import" or with "sass modules"?

@twolfson
Copy link
Owner

twolfson commented Dec 7, 2024

Got it. I somehow read the top of https://sass-lang.com/documentation/values/lists/ and assumed nth was still documented without the list. syntax

Yea, it's been a while since I've maintained this library, and there's a lot of Sass/SCSS templates (3x documented + 3x retina variations).

How about we repurpose the functions key they all share and change its behavior to an enum? (i.e. function: true implies legacy variation, and functions: "module" for this new behavior)

@GregOriol
Copy link
Author

@twolfson The "functions" options could work since "nth" is only used in the mixins and not in the variables, otherwise it would be strange

@twolfson
Copy link
Owner

twolfson commented Dec 9, 2024

Hmm, yea -- good point. I was trying to be too clever.

Let's add a useModules: Boolean key and be done with it (default: false for backwards compatibility)

Do you have bandwidth to pick this up? (I'm glad to handle the documentation part, but lack time for the library portion and tests)

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

No branches or pull requests

2 participants