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

is there a way get styled-components support in React layer #13625

Open
saadjsct opened this issue May 27, 2020 · 5 comments
Open

is there a way get styled-components support in React layer #13625

saadjsct opened this issue May 27, 2020 · 5 comments
Labels
Feature request Help wanted React stale marked as a stale issue/pr (usually by a bot)

Comments

@saadjsct
Copy link

saadjsct commented May 27, 2020

styled-components is a CSS-in-JS library. It is pretty popular now. Is there any way to get syntax highlighting and completion to work.
maybe I can put something in my config that says anything between " styled.anything` " up to " ` " should be in CSS mode, but I don't know where to start.
Thanks.

@tko
Copy link
Contributor

tko commented May 27, 2020

I think it's up to rjsx-mode to support properly felipeochoa/rjsx-mode#71 for the time being.

Someone knowledgeable in elisp might be inclined to investigate using web-mode instead. While it's supposed to handle different languages mixed within each other, it also has some problems which lead to spacemacs replacing web-mode with rjsx-mode in the past so it would be quite a sizable effort as well.

@cmatzenbach
Copy link

The develop branch has a React layer - have you tried that?

https://develop.spacemacs.org/layers/+frameworks/react/README.html

@cmatzenbach
Copy link

cmatzenbach commented Jun 17, 2020

To give you a bit more info, here's my react setup. I used CRA (create-react-app - using typescript so .tsx files), so many of those plugins the doc tells you to install may already be installed - check in your package.json (you DO NOT want to overwrite the versions they have already installed, as I did, because it turns into a MASSIVE dependency mess). I think I did install both js-beautify and prettier (with npm --save-dev), and honestly I'm not sure which one it's using, but spc m = works awesome and cleans up my code for my in an instant. I can post both files if you want. Make sure .eslintrc.js, .jsbeautifyrc, and .prettierrc.js sit in the root of your project. I was kinda dumb and put my api and front-end in the same repo, so my project structure looks like:

  • myproj
    • api/
    • front-end/
    • config files as mentioned (eslint, jsbeautify, prettierrc)

but everything still works fine, and flycheck picks up eslint (you can confirm with spc e v), so somehow my setup worked. I'm considering switching to two separate repos though to simplify things, especially as I learn more and move to docker.

I'll paste my config files for the 3 aformentioned setup files .eslintrc.js .jsbeautifyrc and .prettierrc.js. Hope this helps - let me know if this solves your issue.

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Jun 17, 2021
@lebensterben lebensterben added Feature request Help wanted and removed stale marked as a stale issue/pr (usually by a bot) labels Jun 17, 2021
@lebensterben
Copy link
Collaborator

I removed the stale and added feature-request label:

  • If possible, we'd add better integration of the styled-component into Spacemacs.
  • If there's no readily available packages to do that, and if adding this feature is too complex/tedious, we'd at least add some tips in our react layer's documentation.

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Jun 17, 2022
Repository owner deleted a comment from github-actions bot Sep 15, 2022
Repository owner deleted a comment from github-actions bot Sep 15, 2022
@lebensterben lebensterben removed stale marked as a stale issue/pr (usually by a bot) - Forum - labels Sep 15, 2022
@lebensterben lebensterben reopened this Sep 15, 2022
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

@github-actions github-actions bot added the stale marked as a stale issue/pr (usually by a bot) label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Help wanted React stale marked as a stale issue/pr (usually by a bot)
Projects
None yet
Development

No branches or pull requests

5 participants