Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS样式能支持编辑器提示么? #72

Open
wanliofficial opened this issue Dec 7, 2022 · 4 comments
Open

CSS样式能支持编辑器提示么? #72

wanliofficial opened this issue Dec 7, 2022 · 4 comments

Comments

@wanliofficial
Copy link

组件里面的CSS部分,全是原生CSS,还是使用反引号的字符串,那这样是不是失去了编辑器的提示以及静态语法检查?目前写样式还有更好的处理方式么?能不能支持上sass?

@XboxYan
Copy link
Owner

XboxYan commented Dec 14, 2022

组件里面的CSS部分,全是原生CSS,还是使用反引号的字符串,那这样是不是失去了编辑器的提示以及静态语法检查?目前写样式还有更好的处理方式么?能不能支持上sass?

@wanliofficial 原生 web-components 就是这样写的,没必要用 sass,最大的好处是不需要编译,关于字符串的写法倒是可以换种形式,比如通过外链的方式引入

@XboxYan
Copy link
Owner

XboxYan commented Dec 14, 2022

@wanliofficial 另外,试试纯手写CSS,不用编辑器提示,相信对你的CSS能有很大提升

@wanliofficial
Copy link
Author

ok

@XboxYan
Copy link
Owner

XboxYan commented Feb 21, 2023

@wanliofficial

目前正在用这种方式进行重构

import style from "./index.css" assert { type: "css" };

shadowRoot.adoptedStyleSheets = [style];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants