Open kompot opened 8 years ago
Hey @kompot, check out this comment for usage in IntelliJ.
I wonder why the template literals are getting parsed as HTML by default for you. When I use WebStorm, they are just interpreted as strings until I use the method above to Language Inject CSS.
Let me know if this helps! Though it would be totally cool if csjs could be auto-detected by an IntelliJ plugin...this is definitely worth exploring as the project gains users.
@scott113341 Thanks, I've actually managed to go a bit further and found a way to inject CSS language permanently by using language injection preferences dialog in IDEA and using this pattern.
+ jsLiteralExpression().withText(string().matchesBrics("csjs`.+`"))
But IDEA still does not parse references to variables within CSS. But does that successfully for default template literals assuming it contains plain HTML. So that issue I refer to seems like just a small fix (maybe not, let's see what IDEA's guys are thinking).
Ok, so you are miles ahead of me! Thanks for that pattern, that totally did the trick (minus variable interpolation)! I voted for the issue on their tracker; hopefully that is an easy fix for them.
+1 For Visual Studio Code too ;-)
Hi guys, thanks for a finally nice approach to CSS-in-JS.
I've created an issue to add improved tagged literal injected language support to IntelliJ IDEA. Please vote there https://youtrack.jetbrains.com/issue/WEB-22106 if you'd like to get it done.
Feel free to delete this issue if it bothers your flow.
Thanks.