-
Notifications
You must be signed in to change notification settings - Fork 659
☂️ CSS support #2350
Comments
I was planning on enabling the Rome formatter with its next release to replace prettier in one of our repos, but I realized that CSS formatting, specifically css-in-js, isn't supported yet. Very much looking forward to Rome having CSS formatting support! |
CSS-in-JS is still JavaScript, right? If so, then I believe that that the JS formatter should do that |
It depends on the css-in-js lib, in our case we use linaria so it looks like this: const myClass = css`
color: red;
`; which is plain CSS (without the topmost selector) in a template string. With some other libs like const myClass = style({
color: 'red'
}); which is indeed plain js. |
I did a quick search, I think prettier call these cases "embedded" languages: And yes, they use a different parser/formatter inside these instances. Thank you for pointing it out! |
Could we leverage Lightning CSS (and by extension cssparser) to achieve this? |
We explored cssparser a bit. While it's a good starting point, unfortunately it doesn't fit very well our CST. I haven't done a lot of exploration work, but it seemed that retrieving trivia is not an easy task. |
Any updates on this? |
I've started to implement a lexer for a css parser. |
Description
We are going to use this issue to track the various work around CSS. We don't plan, for the time being, to support super languages, although we might think about preparing the infrastructure to be able to support them.
PREVIOUS DISCUSSIONS: #984
css.ungram
file where we will slowly implement new grammarsrome_css_syntax
crate, where we will have all things related to the CSS syntax, generated code toorome_css_formatter
craterome_formatter
genericThe text was updated successfully, but these errors were encountered: