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

Default namespace? #523

Open
robsonsobral opened this issue Oct 27, 2021 · 7 comments
Open

Default namespace? #523

robsonsobral opened this issue Oct 27, 2021 · 7 comments
Labels

Comments

@robsonsobral
Copy link

One topic per issue?


I've been using my on my tests:

@use '../abstracts' as my;

What do you think, @Elrendio || @KittyGiraudel ?

@KittyGiraudel
Copy link
Owner

Hello! ⭐

Do you mind giving an example of how you use an exposed utility once imported? :)

@robsonsobral
Copy link
Author

Not at all! Take a look!

@use 'config';

@forward 'config';
@forward 'functions' with (
  $my-base-url: config.$base-url,
  $my-breakpoints: config.$breakpoints,
  $my-font-weights: config.$font-weights,
  $my-gutter: config.$gutter,
  $my-palette: config.$palette,
);
@forward 'mixins';

I'm trying to start the discussion for the next version. Maybe I remember of another topics to address.

@robsonsobral
Copy link
Author

Ops! I'm sorry. I misunderstood your question!

I use them this way:

.foo {
  @include my.exposed-mixin('bar');
}

@KittyGiraudel
Copy link
Owner

Ah I see. I’m just remembering how this thing works. Wondering whether or not we should suggest a default namespace. I don’t dislike my, but it might not always be suitable. For instance, team-based authoring might not be super comfortable with a namespace using first person, and our is just silly. 😅

Maybe utils or something? Or perhaps we should just not enforce it in any way?

@robsonsobral
Copy link
Author

I chose my because I was talking to a PERL developer at the time.

I just wanted to feel how would be to code using the namespace idea on my styles. On the bright side, we can avoid collisions between local and global members, like my.column-width and width. On the dark side, it's annoying to call your definitions file again and again. However, we can't avoid the last part.

@robsonsobral
Copy link
Author

I came to the conclusion that to use a namespace is absolutely necessary, to avoid making a mess with new CSS features, like image-set().

@roydukkey
Copy link

I think I would be more in favour of smaller, more focused modules that are namespaced with a singular noun that logically identifies what the modules provides. For example, @use 'query'; for utilities that handle media queries. Or, once developed enough @use 'breakpoint'; for utilities handling breakpoints.

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