Add css

master
yutent 2023-09-19 16:02:35 +08:00
parent 9ea9849471
commit a8b047ee20
1 changed files with 21 additions and 0 deletions

21
css.md Normal file

@ -0,0 +1,21 @@
## `css`函数
> 这个函数, 内部做了兼容处理, 在支持`adoptedStyleSheets`的浏览器上自动使用`adoptedStyleSheets`, 否则转为使用style标签实现。
>> 同时,配合VSCODE插件`string-html-css`, 可实现css语法高亮。
### 注意
> 虽然配合vscode插件, 可以`scss`语汪高亮, 但是`css()`函数本身并不支持解析`scss`的。
如果需要使用`scss`, 需要使用`wkit`的配套的构建工具来编译。
```js
class Foo extends Component {
static styles = css`
.foo { color: red }
`
}
```