Re: [csswg-drafts] Proposal: Custom CSS Functions & Mixins (#9350)

@lilles Some follow-up about nesting in mixins… I don't think that constraint would be a blocker for making this a useful feature. I'm curious if there's any useful distinction between between nested selectors that change the subject, and those that only add additional constraints? For example, selectors like `& > p` or `& + p` would require finding a new selector subject, while `&:hover` adds a constraint to the existing subject. 

> > To avoid accidental conflicts, internal function logic would not have access to external custom properties besides the values explicitly passed in to the defined parameters.
> 
> Is this a strong requirement?

@kizu I would consider it a strong authoring requirement that nothing inside the function should have accidental consequences on values outside the function. I don't know that we need such a strong requirement in the other direction. I don't know if there would be implementation concerns about allowing external values into a function, but I think you're right that it could work for authoring. 

> 1. […] would we be able to somehow pass the return of one mixin as an argument to another?

I'm not familiar with the feature in Stylus, but I think this is similar to the `@content` feature in Sass, and the similar feature [discussed in the explainer](https://css.oddbird.net/sasslike/mixins-functions/#passing-nested-content-to-mixins)?

Similarly, there's a section on [argument conditions and loops](https://css.oddbird.net/sasslike/mixins-functions/#argument-conditions-and-loops) – roughly your points 3 & 2, though I don't go into a lot of detail on lists/maps. In both cases, I considered them potential future extensions rather than essential aspects of a basic function/mixin feature.

-- 
GitHub Notification of comment by mirisuzanne
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9350#issuecomment-1719576889 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 14 September 2023 14:34:57 UTC