sass-guidelines
sass-guidelines copied to clipboard
Default namespace?
One topic per issue?
I've been using my
on my tests:
@use '../abstracts' as my;
What do you think, @Elrendio || @KittyGiraudel ?
Hello! ⭐
Do you mind giving an example of how you use an exposed utility once imported? :)
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.
Ops! I'm sorry. I misunderstood your question!
I use them this way:
.foo {
@include my.exposed-mixin('bar');
}
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?
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.
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()
.
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.