Re: [csswg-drafts] [css-env] Adding custom env() variables (#2627)

Hi.

I would like to know if it would be possible to import constants in css. Would it be possible to import constants in css?

(you all are talking about an alternative to custom media and custom selectors, would it be possible with constants or env... be something imported?)

filename: *constants.css*
```css
@constants {
    --my-unalterable-var: my_Value_That_Is_Selector_Context_Agnostic;
    --breakpoint-s: 640px;
    --body-bg: blue;
}
```


filename: *main.css*
```css
@import "constants.css" constants;
@media screen and (min-width: var(--breakpoint-s, 300px)) {   /* because constants are selector agnostic */
    body {
        --body-bg: red; /* no effect, because --body-bg is already a constant (then it's unalterable) */
        background-color: var(--body-bg, green); /* blue, because --body-bg is simply already defined */
    }
}
```


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


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

Received on Tuesday, 28 February 2023 05:46:24 UTC