[英]Enable autocomplete/intellisense for css in jsx in vscode
Is there an extension for css in jsx (not sure if that is the name, example below) that will enable css autocomplete/intellisense and maybe color syntax in vs-code. jsx 中是否有 css 的扩展(不确定是否是名称,下面的示例),这将启用 css 自动完成/智能感知,并且可能在vs-code 中使用颜色语法。
For css in jsx I mean this:对于 jsx 中的 css,我的意思是:
<style jsx>{`
.class{
font-size:16px;
}
`}</style>
Here is simple solution.这是简单的解决方案。
First Create a CSS file (eg style.css)首先创建一个CSS文件(例如style.css)
yourStyle.css (File) yourStyle.css(文件)
.my-style{
color:red;
background-color:green;
}
and then in your js File simple import This CSS file然后在你的 js 文件中简单导入这个 CSS 文件
import './yourStyle.css'
This one seems to work pretty well: https://github.com/Divlo/vscode-styled-jsx这个似乎工作得很好: https://github.com/Divlo/vscode-styled-jsx
I have found this extension https://marketplace.visualstudio.com/items?itemName=blanu.vscode-styled-jsx for Syntax highlighting for styled-jsx but not for autocomplete/IntelliSense我发现这个扩展https://marketplace.visualstudio.com/items?itemName=blanu.vscode-styled-jsx用于 styled-jsx 的语法突出显示,但不适用于自动完成/IntelliSense
Update: You can use both vscode-styled-components and styled-jsx Language server for achieving this.更新:您可以同时使用vscode-styled-components和styled-jsx 语言服务器来实现这一点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.