webcomponents / webcomponents/custom-elements-manifest

Multiple defaults for CSS Custom Properties

Open
#80 15 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
502
Forks
27
PR merge metrics
No merged PRs in 30d

Description

Consider this case

```js
class MyElement extends HTMLElement {
constructor() {
super().attachShadow({ mode: 'open' }).innerHTML = `

:host { color: var(--my-color, red); }
@media (prefers-color-scheme: dark) {
:host { color: var(--my-color, blue); }
}

`;
}
}
```

Should I get
```json
"cssProperties": [
{
"name": "--my-color",
"default": "red"
}
]
```

Or

```json
"cssProperties": [
{
"name": "--my-color",
"default": "blue"
}
]
```

And if I get either, that's not really correct is it?

We should add a schema facility for declaring multiple defaults and their conditions

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.