简体   繁体   中英

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.

For css in jsx I mean this:

<style jsx>{`
  .class{
     font-size:16px;
  }
`}</style>

Here is simple solution.

First Create a CSS file (eg style.css)

yourStyle.css (File)

.my-style{
    color:red;
    background-color:green;
}

and then in your js File simple import This CSS file

import './yourStyle.css'

This one seems to work pretty well: 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

Update: You can use both vscode-styled-components and styled-jsx Language server for achieving this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM